<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/linear/sequence/dcseq.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/linear/sequence/dcseq.h</h1>  </div>
</div>
<div class="contents">
<a href="dcseq_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_DCSEQ__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_DCSEQ__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;cdef.h&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00022"></a>00022 <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00023"></a>00023 <span class="preprocessor">#else</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00026"></a>00026 
<a name="l00038"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gab9e84c06cd2a829fa3d8abf71da2b42a">00038</a> <span class="preprocessor">#define dcseq_iter(type) type *</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00049"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaf36c9494198335d502044cabf6953610">00049</a> <span class="preprocessor">#define dcseq_head(type) \</span>
<a name="l00050"></a>00050 <span class="preprocessor">    struct { type * first; type * last; type * end; type * base; }</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define dcseq dcseq_head</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00060"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaaa9ad0649de8ea4a8c0253f70c711f37">00060</a> <span class="preprocessor">#define DCSEQ_HEAD(type, name, arr) \</span>
<a name="l00061"></a>00061 <span class="preprocessor">    dcseq_head(type) name = {arr, arr, &amp;arr[count_of(arr)], arr}</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define DCSEQ DCSEQ_HEAD</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span>
<a name="l00072"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga1a4606e6ed271c585d431d43acfbfd02">00072</a> <span class="preprocessor">#define dcseq_pr1(type) int (*)(type *)</span>
<a name="l00073"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gadd479f30e6ab346585935f56bd7459a9">00073</a> <span class="preprocessor"></span><span class="preprocessor">#define dcseq_pr2(type) int (*)(type *, type *)</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span>
<a name="l00075"></a>00075 <span class="preprocessor">#define DCSEQ_CHECK_PASS        0 </span><span class="comment">/* 正常 */</span>
<a name="l00076"></a>00076 <span class="preprocessor">#define DCSEQ_CHECK_INVALID     1 </span><span class="comment">/* 无效缓存 */</span>
<a name="l00077"></a>00077 <span class="preprocessor">#define DCSEQ_CHECK_OVERFLOW    2 </span><span class="comment">/* 溢出 */</span>
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_check(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last,
<a name="l00080"></a>00080                                 <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* base)
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082     <span class="keywordflow">if</span> (!base || base &gt;= end || first &gt;= end)
<a name="l00083"></a>00083         <span class="keywordflow">return</span> DCSEQ_CHECK_INVALID;
<a name="l00084"></a>00084     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (last &gt; end || first &lt; base)
<a name="l00085"></a>00085         <span class="keywordflow">return</span> DCSEQ_CHECK_OVERFLOW;
<a name="l00086"></a>00086     <span class="keywordflow">else</span>
<a name="l00087"></a>00087         <span class="keywordflow">return</span> DCSEQ_CHECK_PASS;
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089 
<a name="l00099"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gab0d5ab66eaae015aec90fd350b9eae09">00099</a> <span class="preprocessor">#define dcseq_check(head) \</span>
<a name="l00100"></a>00100 <span class="preprocessor">    __dcseq_check((char*)((head)-&gt;first),   \</span>
<a name="l00101"></a>00101 <span class="preprocessor">                  (char*)((head)-&gt;last),    \</span>
<a name="l00102"></a>00102 <span class="preprocessor">                  (char*)((head)-&gt;end),     \</span>
<a name="l00103"></a>00103 <span class="preprocessor">                  (char*)((head)-&gt;base))</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span>
<a name="l00114"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga9f0e8604b0bc82cf270a109858916206">00114</a> <span class="preprocessor">#define dcseq_reset(head, _base, _first, _last, _end) \</span>
<a name="l00115"></a>00115 <span class="preprocessor">    do {(head)-&gt;base = (_base);         \</span>
<a name="l00116"></a>00116 <span class="preprocessor">        (head)-&gt;first = (_first);       \</span>
<a name="l00117"></a>00117 <span class="preprocessor">        (head)-&gt;last = (_last);         \</span>
<a name="l00118"></a>00118 <span class="preprocessor">        (head)-&gt;end = (_end);           \</span>
<a name="l00119"></a>00119 <span class="preprocessor">    } while (0)</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span>
<a name="l00131"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga701f256d0417a216e24aba367299d21d">00131</a> <span class="preprocessor">#define dcseq_init(type, head, base, size, _first)  \</span>
<a name="l00132"></a>00132 <span class="preprocessor">    dcseq_reset(head, (type *)(base),               \</span>
<a name="l00133"></a>00133 <span class="preprocessor">                (type *)(base) + (_first),          \</span>
<a name="l00134"></a>00134 <span class="preprocessor">                (type *)(base) + (_first),          \</span>
<a name="l00135"></a>00135 <span class="preprocessor">                (type *)(base) + (size))            \</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span>
<a name="l00137"></a>00137 <span class="preprocessor"></span>
<a name="l00166"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gac17f58b3615d1aa47f9b7e7f4a65245b">00166</a> <span class="preprocessor">#define dcseq_init_serial(type, head, base, size, cnt)  \</span>
<a name="l00167"></a>00167 <span class="preprocessor">    dcseq_reset(head, (type *)(base), (type *)(base),   \</span>
<a name="l00168"></a>00168 <span class="preprocessor">                (type *)(base) + (cnt),                 \</span>
<a name="l00169"></a>00169 <span class="preprocessor">                (type *)(base) + (size))</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
<a name="l00187"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga52767fda1e9acae34cafd48067edfecc">00187</a> <span class="preprocessor">#define DCSEQ_INIT(type, head, arr, _first) \</span>
<a name="l00188"></a>00188 <span class="preprocessor">    dcseq_init(type, head, arr, count_of(arr), _first)</span>
<a name="l00189"></a>00189 <span class="preprocessor"></span>
<a name="l00207"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaa10646448a570409afa332c4715bbc86">00207</a> <span class="preprocessor">#define DCSEQ_INIT_SERIAL(type, head, arr, cnt) \</span>
<a name="l00208"></a>00208 <span class="preprocessor">    dcseq_init_serial(type, head, arr, count_of(arr), cnt)</span>
<a name="l00209"></a>00209 <span class="preprocessor"></span>
<a name="l00215"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gae233ba04d3c32eb008578f5a8491d2bd">00215</a> <span class="preprocessor">#define dcseq_clear(head) \</span>
<a name="l00216"></a>00216 <span class="preprocessor">    ((head)-&gt;last = (head)-&gt;first = (head)-&gt;base)</span>
<a name="l00217"></a>00217 <span class="preprocessor"></span>
<a name="l00224"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gae6ed56f7e82b2e748f64eee7ad4f2db2">00224</a> <span class="preprocessor">#define dcseq_base(head) ((head)-&gt;base)</span>
<a name="l00225"></a>00225 <span class="preprocessor"></span>
<a name="l00232"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaedbaf43349facc54fd28d5c3ac6dec95">00232</a> <span class="preprocessor">#define dcseq_count(head) \</span>
<a name="l00233"></a>00233 <span class="preprocessor">    __dcseq_count(dcseq_size(head), (head)-&gt;last - (head)-&gt;first)</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span>
<a name="l00235"></a>00235 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> __dcseq_count(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist)
<a name="l00236"></a>00236 {
<a name="l00237"></a>00237     <span class="keywordflow">return</span> (dist &gt;= 0)? dist: dist + size;
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 
<a name="l00247"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gade232607f6d9ee8609f8e5e3aebccd7a">00247</a> <span class="preprocessor">#define dcseq_size(head) ((size_t)((head)-&gt;end - (head)-&gt;base))</span>
<a name="l00248"></a>00248 <span class="preprocessor"></span>
<a name="l00256"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga6bbe2621089c0d1266e48dd6cc3cce05">00256</a> <span class="preprocessor">#define dcseq_capacity(head) (dcseq_size(head) - 1)</span>
<a name="l00257"></a>00257 <span class="preprocessor"></span>
<a name="l00265"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga54d4be34663a21a7eff83ca2f9a0b69b">00265</a> <span class="preprocessor">#define dcseq_remain(head) (dcseq_capacity(head) - dcseq_count(head))</span>
<a name="l00266"></a>00266 <span class="preprocessor"></span>
<a name="l00276"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga3b0a7a36f573ff453f05a29b1f49dc0d">00276</a> <span class="preprocessor">#define dcseq_empty(head) \</span>
<a name="l00277"></a>00277 <span class="preprocessor">    __dcseq_empty((char*)((head)-&gt;first), (char*)((head)-&gt;last))</span>
<a name="l00278"></a>00278 <span class="preprocessor"></span>
<a name="l00279"></a>00279 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_empty(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last)
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281     <span class="keywordflow">return</span> first == last;
<a name="l00282"></a>00282 }
<a name="l00283"></a>00283 
<a name="l00293"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gac8928e1e92dfafbc3e823d4edf7d79bd">00293</a> <span class="preprocessor">#define dcseq_full(head) \</span>
<a name="l00294"></a>00294 <span class="preprocessor">    __dcseq_full((char*)((head)-&gt;base), (char*)((head)-&gt;first),    \</span>
<a name="l00295"></a>00295 <span class="preprocessor">                 (char*)((head)-&gt;end), (char*)((head)-&gt;last + 1))</span>
<a name="l00296"></a>00296 <span class="preprocessor"></span>
<a name="l00297"></a>00297 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_full(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* first,
<a name="l00298"></a>00298                                <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* last_next)
<a name="l00299"></a>00299 {
<a name="l00300"></a>00300     <span class="keywordflow">return</span> (last_next == first) ||
<a name="l00301"></a>00301         ((first = base) &amp;&amp; (last_next == end));
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303 
<a name="l00312"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga3282309a688e1a002cc0786a5791d9c7">00312</a> <span class="preprocessor">#define dcseq_singular(head) \</span>
<a name="l00313"></a>00313 <span class="preprocessor">    __dcseq_singular((char*)((head)-&gt;base), \</span>
<a name="l00314"></a>00314 <span class="preprocessor">                     (char*)((head)-&gt;last), \</span>
<a name="l00315"></a>00315 <span class="preprocessor">                     (char*)((head)-&gt;end),  \</span>
<a name="l00316"></a>00316 <span class="preprocessor">                     (char*)((head)-&gt;first + 1))</span>
<a name="l00317"></a>00317 <span class="preprocessor"></span>
<a name="l00318"></a>00318 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_singular(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* last,
<a name="l00319"></a>00319                                    <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* first_next)
<a name="l00320"></a>00320 {
<a name="l00321"></a>00321     <span class="keywordflow">return</span> (last == first_next) ||
<a name="l00322"></a>00322         ((base == last) &amp;&amp; (first_next &gt;= end));
<a name="l00323"></a>00323 }
<a name="l00324"></a>00324 
<a name="l00333"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga37a0ad76a4d6e0e445e96215c7331739">00333</a> <span class="preprocessor">#define dcseq_sortable(head) \</span>
<a name="l00334"></a>00334 <span class="preprocessor">    __dcseq_sortable(dcseq_size(head), (head)-&gt;last - (head)-&gt;first)</span>
<a name="l00335"></a>00335 <span class="preprocessor"></span>
<a name="l00336"></a>00336 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_sortable(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist)
<a name="l00337"></a>00337 {
<a name="l00338"></a>00338     <span class="keywordflow">return</span> (dist &gt; 1) || (__dcseq_count(size, dist) &gt; 1);
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340 
<a name="l00350"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gacf351a975e83708d43977233acfcc223">00350</a> <span class="preprocessor">#define dcseq_insertable(head, cnt) \</span>
<a name="l00351"></a>00351 <span class="preprocessor">    __dcseq_insertable(dcseq_size(head), \</span>
<a name="l00352"></a>00352 <span class="preprocessor">        (head)-&gt;last - (head)-&gt;first, (int)(cnt))</span>
<a name="l00353"></a>00353 <span class="preprocessor"></span>
<a name="l00354"></a>00354 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_insertable(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist, <span class="keywordtype">int</span> cnt)
<a name="l00355"></a>00355 {
<a name="l00356"></a>00356     <span class="keywordflow">return</span> size &gt;= (int)__dcseq_count(size, dist) + cnt + 1;
<a name="l00357"></a>00357 }
<a name="l00358"></a>00358 
<a name="l00367"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga291b691ec419c75159823ecae81d8587">00367</a> <span class="preprocessor">#define dcseq_serialable(head) \</span>
<a name="l00368"></a>00368 <span class="preprocessor">    __dcseq_serialable((char*)((head)-&gt;first), (char*)((head)-&gt;last))</span>
<a name="l00369"></a>00369 <span class="preprocessor"></span>
<a name="l00370"></a>00370 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_serialable(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last)
<a name="l00371"></a>00371 {
<a name="l00372"></a>00372     <span class="keywordflow">return</span> first != last;
<a name="l00373"></a>00373 }
<a name="l00374"></a>00374 
<a name="l00384"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga27c8c83b6f266c1d9ffa8ed8c0aaac21">00384</a> <span class="preprocessor">#define dcseq_copyable(dst, src) \</span>
<a name="l00385"></a>00385 <span class="preprocessor">    __dcseq_copyable((char*)(dst), (char*)(src),    \</span>
<a name="l00386"></a>00386 <span class="preprocessor">                     (char*)((src)-&gt;first),         \</span>
<a name="l00387"></a>00387 <span class="preprocessor">                     (char*)((src)-&gt;last),          \</span>
<a name="l00388"></a>00388 <span class="preprocessor">                     (char*)((src)-&gt;base),          \</span>
<a name="l00389"></a>00389 <span class="preprocessor">                     (char*)((src)-&gt;end),           \</span>
<a name="l00390"></a>00390 <span class="preprocessor">                     (char*)((dst)-&gt;base),          \</span>
<a name="l00391"></a>00391 <span class="preprocessor">                     (char*)((dst)-&gt;end))</span>
<a name="l00392"></a>00392 <span class="preprocessor"></span>
<a name="l00393"></a>00393 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_copyable(<span class="keywordtype">char</span>* dst, <span class="keywordtype">char</span>* src,
<a name="l00394"></a>00394                                    <span class="keywordtype">char</span>* s_first, <span class="keywordtype">char</span>* s_last,
<a name="l00395"></a>00395                                    <span class="keywordtype">char</span>* s_base, <span class="keywordtype">char</span>* s_end,
<a name="l00396"></a>00396                                    <span class="keywordtype">char</span>* d_base, <span class="keywordtype">char</span>* d_end)
<a name="l00397"></a>00397 {
<a name="l00398"></a>00398     <span class="keywordtype">size_t</span> sz;
<a name="l00399"></a>00399     <span class="keywordflow">if</span> (s_first &gt; s_last)
<a name="l00400"></a>00400         sz = (s_end - s_first) + (s_last - s_base);
<a name="l00401"></a>00401     <span class="keywordflow">else</span>
<a name="l00402"></a>00402         sz = s_last - s_first;
<a name="l00403"></a>00403     <span class="keywordflow">return</span> (dst != src &amp;&amp; (s_last != s_first) &amp;&amp;
<a name="l00404"></a>00404          (d_end &gt;= d_base + sz));
<a name="l00405"></a>00405 }
<a name="l00406"></a>00406 
<a name="l00415"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gacc42c81d740d37cc0d1cfd667269f7e2">00415</a> <span class="preprocessor">#define dcseq_at(type, head, index) \</span>
<a name="l00416"></a>00416 <span class="preprocessor">    __dcseq_at(type, (head)-&gt;base, (head)-&gt;end, (head)-&gt;first + (index))</span>
<a name="l00417"></a>00417 <span class="preprocessor"></span>
<a name="l00418"></a>00418 <span class="preprocessor">#define __dcseq_at(type, base, end, dest) \</span>
<a name="l00419"></a>00419 <span class="preprocessor">    ((type *)__do_dcseq_at((char*)(base), (char*)(end), (char*)(dest)))</span>
<a name="l00420"></a>00420 <span class="preprocessor"></span>
<a name="l00421"></a>00421 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_at(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* dest)
<a name="l00422"></a>00422 {
<a name="l00423"></a>00423     <span class="keywordflow">return</span> (dest &gt;= end)? base + (dest - end): dest;
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 
<a name="l00434"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga39ffa37877fb5f868b548f2ea6a64d6c">00434</a> <span class="preprocessor">#define dcseq_reverse_at(type, head, index) \</span>
<a name="l00435"></a>00435 <span class="preprocessor">    __dcseq_reverse_at(type, (head)-&gt;base, (head)-&gt;end, \</span>
<a name="l00436"></a>00436 <span class="preprocessor">                        (head)-&gt;last - ((index) + 1))</span>
<a name="l00437"></a>00437 <span class="preprocessor"></span>
<a name="l00438"></a>00438 <span class="preprocessor">#define __dcseq_reverse_at(type, base, end, dest) \</span>
<a name="l00439"></a>00439 <span class="preprocessor">    ((type *)__do_dcseq_reverse_at((char*)(base), \</span>
<a name="l00440"></a>00440 <span class="preprocessor">                        (char*)(end), (char*)(dest)))</span>
<a name="l00441"></a>00441 <span class="preprocessor"></span>
<a name="l00442"></a>00442 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_reverse_at(<span class="keywordtype">char</span>* base,
<a name="l00443"></a>00443                                         <span class="keywordtype">char</span>* end,
<a name="l00444"></a>00444                                         <span class="keywordtype">char</span>* dest)
<a name="l00445"></a>00445 {
<a name="l00446"></a>00446     <span class="keywordflow">return</span> (base &lt;= dest)? dest: dest + (end - base);
<a name="l00447"></a>00447 }
<a name="l00448"></a>00448 
<a name="l00456"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga7c7c54b5a59f69d9695c4fe01a1c26a2">00456</a> <span class="preprocessor">#define dcseq_index_of(head, itr) \</span>
<a name="l00457"></a>00457 <span class="preprocessor">    __dcseq_index_of(dcseq_size(head), (itr) - (head)-&gt;first)</span>
<a name="l00458"></a>00458 <span class="preprocessor"></span>
<a name="l00459"></a>00459 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> __dcseq_index_of(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist)
<a name="l00460"></a>00460 {
<a name="l00461"></a>00461     <span class="keywordflow">return</span> (dist &gt;= 0)? dist: dist + size;
<a name="l00462"></a>00462 }
<a name="l00463"></a>00463 
<a name="l00471"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gafcad503fcb29e86a6edc09da7e4fd830">00471</a> <span class="preprocessor">#define dcseq_reverse_index_of(head, itr) \</span>
<a name="l00472"></a>00472 <span class="preprocessor">    __dcseq_reverse_index_of(dcseq_size(head), (head)-&gt;last - (itr))</span>
<a name="l00473"></a>00473 <span class="preprocessor"></span>
<a name="l00474"></a>00474 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> __dcseq_reverse_index_of(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist)
<a name="l00475"></a>00475 {
<a name="l00476"></a>00476     <span class="keywordflow">return</span> (dist &gt; 0)? dist - 1: size + dist - 1;
<a name="l00477"></a>00477 }
<a name="l00478"></a>00478 
<a name="l00488"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga31835b5d37c85a1d9a7c2b0cbc753123">00488</a> <span class="preprocessor">#define dcseq_exist(head, itr) \</span>
<a name="l00489"></a>00489 <span class="preprocessor">    __dcseq_exist((head)-&gt;base, (head)-&gt;first, (head)-&gt;last, (head)-&gt;end, itr)</span>
<a name="l00490"></a>00490 <span class="preprocessor"></span>
<a name="l00491"></a>00491 <span class="preprocessor">#define __dcseq_exist(base, first, last, end, itr) \</span>
<a name="l00492"></a>00492 <span class="preprocessor">    __do_dcseq_exist((char*)(base), (char*)(first), \</span>
<a name="l00493"></a>00493 <span class="preprocessor">        (char*)(last), (char*)(end), (char*)(itr))</span>
<a name="l00494"></a>00494 <span class="preprocessor"></span>
<a name="l00495"></a>00495 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __do_dcseq_exist(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* first,
<a name="l00496"></a>00496                                    <span class="keywordtype">char</span>* last, <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* itr)
<a name="l00497"></a>00497 {
<a name="l00498"></a>00498     <span class="keywordflow">if</span> (itr &lt; base || itr &gt;= end)
<a name="l00499"></a>00499         <span class="keywordflow">return</span> 0;
<a name="l00500"></a>00500     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first &gt; last)
<a name="l00501"></a>00501         <span class="keywordflow">return</span> (itr &gt;= first || itr &lt; last)? 1: 0;
<a name="l00502"></a>00502     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (itr &gt;= first &amp;&amp; itr &lt; last)
<a name="l00503"></a>00503         <span class="keywordflow">return</span> 1;
<a name="l00504"></a>00504     <span class="keywordflow">return</span> 0;
<a name="l00505"></a>00505 }
<a name="l00506"></a>00506 
<a name="l00515"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5ec04ebafe9d653d3be80562f5b772eb">00515</a> <span class="preprocessor">#define dcseq_distance(head, first, last) \</span>
<a name="l00516"></a>00516 <span class="preprocessor">    __dcseq_distance(dcseq_size(head), (last) - (first))</span>
<a name="l00517"></a>00517 <span class="preprocessor"></span>
<a name="l00518"></a>00518 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> __dcseq_distance(<span class="keywordtype">int</span> size, <span class="keywordtype">int</span> dist)
<a name="l00519"></a>00519 {
<a name="l00520"></a>00520     <span class="keywordflow">return</span> (dist &gt;= 0)? dist + 1: size + dist + 1;
<a name="l00521"></a>00521 }
<a name="l00522"></a>00522 
<a name="l00532"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga2c7dab6b2be2e3a8d6bd95c7b06791ae">00532</a> <span class="preprocessor">#define dcseq_insert(type, head, pos, newly) do {                               \</span>
<a name="l00533"></a>00533 <span class="preprocessor">        type * _q_p = (type *)(pos);                                            \</span>
<a name="l00534"></a>00534 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                            \</span>
<a name="l00535"></a>00535 <span class="preprocessor">        type * _q_L = (head)-&gt;last;                                             \</span>
<a name="l00536"></a>00536 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                              \</span>
<a name="l00537"></a>00537 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                             \</span>
<a name="l00538"></a>00538 <span class="preprocessor">        if (_q_p == _q_F)                                                       \</span>
<a name="l00539"></a>00539 <span class="preprocessor">            _q_p = ((head)-&gt;first = __dcseq_prev(_q_B, _q_E, _q_F));            \</span>
<a name="l00540"></a>00540 <span class="preprocessor">        else if (_q_p == _q_L)                                                  \</span>
<a name="l00541"></a>00541 <span class="preprocessor">            (head)-&gt;last = __dcseq_next(_q_B, _q_E, _q_L);                      \</span>
<a name="l00542"></a>00542 <span class="preprocessor">        else if (_q_F &lt; _q_L) {                                                 \</span>
<a name="l00543"></a>00543 <span class="preprocessor">            if ((_q_p - _q_F) &lt;= ((_q_L - _q_p) &lt;&lt; 1)) {                       \</span>
<a name="l00544"></a>00544 <span class="preprocessor">                if (_q_F == _q_B) {                                             \</span>
<a name="l00545"></a>00545 <span class="preprocessor">                    *(_q_E - 1) = *_q_F;                                        \</span>
<a name="l00546"></a>00546 <span class="preprocessor">                    memcpy(_q_F, _q_F + 1, sizeof(type) * ((--_q_p) - _q_F));  \</span>
<a name="l00547"></a>00547 <span class="preprocessor">                    (head)-&gt;first = _q_E - 1;                                   \</span>
<a name="l00548"></a>00548 <span class="preprocessor">                } else {                                                        \</span>
<a name="l00549"></a>00549 <span class="preprocessor">                    memcpy(_q_F - 1, _q_F, sizeof(type) * ((_q_p--) - _q_F));  \</span>
<a name="l00550"></a>00550 <span class="preprocessor">                    --(head)-&gt;first;                                            \</span>
<a name="l00551"></a>00551 <span class="preprocessor">                }                                                               \</span>
<a name="l00552"></a>00552 <span class="preprocessor">            } else {                                                            \</span>
<a name="l00553"></a>00553 <span class="preprocessor">                memmove(_q_p + 1, _q_p, sizeof(type) * (_q_L - _q_p));          \</span>
<a name="l00554"></a>00554 <span class="preprocessor">                (head)-&gt;last = __dcseq_next(_q_B, _q_E, _q_L);                  \</span>
<a name="l00555"></a>00555 <span class="preprocessor">            }                                                                   \</span>
<a name="l00556"></a>00556 <span class="preprocessor">        } else {                                                                \</span>
<a name="l00557"></a>00557 <span class="preprocessor">            int _q_n = ((_q_E - _q_F) + (_q_L - _q_B)) &gt;&gt; 1;                    \</span>
<a name="l00558"></a>00558 <span class="preprocessor">            if (_q_p &gt; _q_F) {                                                  \</span>
<a name="l00559"></a>00559 <span class="preprocessor">                if ((_q_p - _q_F) &lt;= _q_n) {                                    \</span>
<a name="l00560"></a>00560 <span class="preprocessor">                    memcpy(_q_F - 1, _q_F, sizeof(type) * ((_q_p--) - _q_F));  \</span>
<a name="l00561"></a>00561 <span class="preprocessor">                    --(head)-&gt;first;                                            \</span>
<a name="l00562"></a>00562 <span class="preprocessor">                } else {                                                        \</span>
<a name="l00563"></a>00563 <span class="preprocessor">                    memmove(_q_B + 1, _q_B, sizeof(type) * (_q_L - _q_B));      \</span>
<a name="l00564"></a>00564 <span class="preprocessor">                    *_q_B = *(_q_E - 1);                                        \</span>
<a name="l00565"></a>00565 <span class="preprocessor">                    memmove(_q_p + 1, _q_p, sizeof(type) * (_q_E - _q_p - 1));  \</span>
<a name="l00566"></a>00566 <span class="preprocessor">                    ++(head)-&gt;last;                                             \</span>
<a name="l00567"></a>00567 <span class="preprocessor">                }                                                               \</span>
<a name="l00568"></a>00568 <span class="preprocessor">            } else {                                                            \</span>
<a name="l00569"></a>00569 <span class="preprocessor">                if ((_q_p - _q_B) &gt; _q_n) {                                     \</span>
<a name="l00570"></a>00570 <span class="preprocessor">                    memcpy(_q_F - 1, _q_F, sizeof(type) * (_q_E - _q_F));       \</span>
<a name="l00571"></a>00571 <span class="preprocessor">                    *(_q_E - 1) = *_q_B;                                        \</span>
<a name="l00572"></a>00572 <span class="preprocessor">                    memcpy(_q_B, _q_B + 1, sizeof(type) * ((--_q_p) - _q_B));  \</span>
<a name="l00573"></a>00573 <span class="preprocessor">                    --(head)-&gt;first;                                            \</span>
<a name="l00574"></a>00574 <span class="preprocessor">                } else {                                                        \</span>
<a name="l00575"></a>00575 <span class="preprocessor">                    memmove(_q_p + 1, _q_p, sizeof(type) * (_q_L - _q_p));      \</span>
<a name="l00576"></a>00576 <span class="preprocessor">                    ++(head)-&gt;last;                                             \</span>
<a name="l00577"></a>00577 <span class="preprocessor">                }                                                               \</span>
<a name="l00578"></a>00578 <span class="preprocessor">            }                                                                   \</span>
<a name="l00579"></a>00579 <span class="preprocessor">        }                                                                       \</span>
<a name="l00580"></a>00580 <span class="preprocessor">        *_q_p = (newly);                                                        \</span>
<a name="l00581"></a>00581 <span class="preprocessor">    } while (0)</span>
<a name="l00582"></a>00582 <span class="preprocessor"></span>
<a name="l00591"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5620ad4a15ef8bb65f58b34b57be17b9">00591</a> <span class="preprocessor">#define dcseq_erase(type, head, pos) do {                                       \</span>
<a name="l00592"></a>00592 <span class="preprocessor">        type * _q_p = (type *)(pos);                                            \</span>
<a name="l00593"></a>00593 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                            \</span>
<a name="l00594"></a>00594 <span class="preprocessor">        type * _q_L = (head)-&gt;last;                                             \</span>
<a name="l00595"></a>00595 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                              \</span>
<a name="l00596"></a>00596 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                             \</span>
<a name="l00597"></a>00597 <span class="preprocessor">        if (_q_F &lt; _q_L) {                                                      \</span>
<a name="l00598"></a>00598 <span class="preprocessor">            if ((_q_L - _q_p) &lt;= ((_q_p - _q_F) &gt;&gt; 1)) {                       \</span>
<a name="l00599"></a>00599 <span class="preprocessor">                memcpy(_q_p, _q_p + 1, sizeof(type) * (_q_L - _q_p - 1));       \</span>
<a name="l00600"></a>00600 <span class="preprocessor">                --(head)-&gt;last;                                                 \</span>
<a name="l00601"></a>00601 <span class="preprocessor">            } else {                                                            \</span>
<a name="l00602"></a>00602 <span class="preprocessor">                memmove(_q_F + 1, _q_F, sizeof(type) * (_q_p - _q_F));          \</span>
<a name="l00603"></a>00603 <span class="preprocessor">                ++(head)-&gt;first;                                                \</span>
<a name="l00604"></a>00604 <span class="preprocessor">            }                                                                   \</span>
<a name="l00605"></a>00605 <span class="preprocessor">        } else if (_q_p &gt;= _q_F) {                                              \</span>
<a name="l00606"></a>00606 <span class="preprocessor">            if ((_q_p - _q_F) &lt;= (((_q_E - _q_p) + (_q_L - _q_B)) &lt;&lt; 1)) {   \</span>
<a name="l00607"></a>00607 <span class="preprocessor">                memmove(_q_F + 1, _q_F, sizeof(type) * (_q_p - _q_F));          \</span>
<a name="l00608"></a>00608 <span class="preprocessor">                ++(head)-&gt;first;                                                \</span>
<a name="l00609"></a>00609 <span class="preprocessor">            } else {                                                            \</span>
<a name="l00610"></a>00610 <span class="preprocessor">                memcpy(_q_p, _q_p + 1, sizeof(type) * (_q_E - _q_p - 1));       \</span>
<a name="l00611"></a>00611 <span class="preprocessor">                if (_q_L == _q_B) {                                             \</span>
<a name="l00612"></a>00612 <span class="preprocessor">                    (head)-&gt;last = _q_E - 1;                                    \</span>
<a name="l00613"></a>00613 <span class="preprocessor">                } else {                                                        \</span>
<a name="l00614"></a>00614 <span class="preprocessor">                    *(_q_E - 1) = *_q_B;                                        \</span>
<a name="l00615"></a>00615 <span class="preprocessor">                    memcpy(_q_B, _q_B + 1, sizeof(type) * (_q_L - _q_B - 1));   \</span>
<a name="l00616"></a>00616 <span class="preprocessor">                    --(head)-&gt;last;                                             \</span>
<a name="l00617"></a>00617 <span class="preprocessor">                }                                                               \</span>
<a name="l00618"></a>00618 <span class="preprocessor">            }                                                                   \</span>
<a name="l00619"></a>00619 <span class="preprocessor">        } else if ((_q_L - _q_p) &lt;= (((_q_E - _q_F) + (_q_p - _q_B)) &lt;&lt; 1)) {\</span>
<a name="l00620"></a>00620 <span class="preprocessor">            memcpy(_q_p, _q_p + 1, sizeof(type) * (_q_L - _q_p - 1));           \</span>
<a name="l00621"></a>00621 <span class="preprocessor">            --(head)-&gt;last;                                                     \</span>
<a name="l00622"></a>00622 <span class="preprocessor">        } else {                                                                \</span>
<a name="l00623"></a>00623 <span class="preprocessor">            memmove(_q_B + 1, _q_B, sizeof(type) * (_q_p - _q_B));              \</span>
<a name="l00624"></a>00624 <span class="preprocessor">            *_q_B = *(_q_E - 1);                                                \</span>
<a name="l00625"></a>00625 <span class="preprocessor">            memmove(_q_F + 1, _q_F, sizeof(type) * (_q_E - _q_F - 1));          \</span>
<a name="l00626"></a>00626 <span class="preprocessor">            (head)-&gt;first = __dcseq_next(_q_B, _q_E, _q_F);                     \</span>
<a name="l00627"></a>00627 <span class="preprocessor">        }                                                                       \</span>
<a name="l00628"></a>00628 <span class="preprocessor">    } while (0)</span>
<a name="l00629"></a>00629 <span class="preprocessor"></span>
<a name="l00648"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga81be7d5f42effc8658ab6fd93ec2f165">00648</a> <span class="preprocessor">#define dcseq_inserts(type, head, pos, src, cnt) do {                           \</span>
<a name="l00649"></a>00649 <span class="preprocessor">        size_t _q_c = (size_t)(cnt);                                            \</span>
<a name="l00650"></a>00650 <span class="preprocessor">        type * _q_s = (type *)(src);                                            \</span>
<a name="l00651"></a>00651 <span class="preprocessor">        type * _q_p = (type *)(pos);                                            \</span>
<a name="l00652"></a>00652 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                            \</span>
<a name="l00653"></a>00653 <span class="preprocessor">        type * _q_L = (head)-&gt;last;                                             \</span>
<a name="l00654"></a>00654 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                              \</span>
<a name="l00655"></a>00655 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                             \</span>
<a name="l00656"></a>00656 <span class="preprocessor">        if (_q_p &gt;= _q_F) {                                                     \</span>
<a name="l00657"></a>00657 <span class="preprocessor">            size_t _q_fc = _q_F - _q_B;                                         \</span>
<a name="l00658"></a>00658 <span class="preprocessor">            if (_q_fc &gt;= _q_c) {                                                \</span>
<a name="l00659"></a>00659 <span class="preprocessor">                memcpy(_q_F - _q_c, _q_F, sizeof(type) * (_q_p - _q_F));        \</span>
<a name="l00660"></a>00660 <span class="preprocessor">                memcpy(_q_p - _q_c, _q_s, sizeof(type) * _q_c);                 \</span>
<a name="l00661"></a>00661 <span class="preprocessor">                (head)-&gt;first = _q_F - _q_c;                                    \</span>
<a name="l00662"></a>00662 <span class="preprocessor">            } else {                                                            \</span>
<a name="l00663"></a>00663 <span class="preprocessor">                size_t _q_n = _q_c - _q_fc;                                     \</span>
<a name="l00664"></a>00664 <span class="preprocessor">                size_t _q_m = _q_p - _q_F;                                      \</span>
<a name="l00665"></a>00665 <span class="preprocessor">                if (_q_n &gt;= _q_m) {                                             \</span>
<a name="l00666"></a>00666 <span class="preprocessor">                    size_t _q_r = _q_n - _q_m;                                  \</span>
<a name="l00667"></a>00667 <span class="preprocessor">                    memcpy(_q_E - _q_n, _q_F, sizeof(type) * _q_m);             \</span>
<a name="l00668"></a>00668 <span class="preprocessor">                    memcpy(_q_E - _q_r, _q_s, sizeof(type) * _q_r);             \</span>
<a name="l00669"></a>00669 <span class="preprocessor">                    memcpy(_q_B, _q_s + _q_r, sizeof(type) * (_q_c - _q_r));    \</span>
<a name="l00670"></a>00670 <span class="preprocessor">                } else {                                                        \</span>
<a name="l00671"></a>00671 <span class="preprocessor">                    memcpy(_q_E - _q_n, _q_F, sizeof(type) * _q_n);             \</span>
<a name="l00672"></a>00672 <span class="preprocessor">                    memcpy(_q_B, _q_F + _q_n, sizeof(type) * (_q_m - _q_n));    \</span>
<a name="l00673"></a>00673 <span class="preprocessor">                    memcpy(_q_B + (_q_m - _q_n), _q_s, sizeof(type) * _q_c);    \</span>
<a name="l00674"></a>00674 <span class="preprocessor">                }                                                               \</span>
<a name="l00675"></a>00675 <span class="preprocessor">                (head)-&gt;first = _q_E - _q_n;                                    \</span>
<a name="l00676"></a>00676 <span class="preprocessor">            }                                                                   \</span>
<a name="l00677"></a>00677 <span class="preprocessor">        } else {                                                                \</span>
<a name="l00678"></a>00678 <span class="preprocessor">            memmove(_q_p + _q_c, _q_p, sizeof(type) * (_q_L - _q_p));           \</span>
<a name="l00679"></a>00679 <span class="preprocessor">            memcpy(_q_p, _q_s, sizeof(type) * _q_c);                            \</span>
<a name="l00680"></a>00680 <span class="preprocessor">            (head)-&gt;last = _q_L + _q_c;                                         \</span>
<a name="l00681"></a>00681 <span class="preprocessor">        }                                                                       \</span>
<a name="l00682"></a>00682 <span class="preprocessor">    } while (0)</span>
<a name="l00683"></a>00683 <span class="preprocessor"></span>
<a name="l00692"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga8a1d8b81cb254000f03e129143c80a8d">00692</a> <span class="preprocessor">#define dcseq_erases(type, head, _begin, _end) do {                         \</span>
<a name="l00693"></a>00693 <span class="preprocessor">        type * _q_e = (type *)(_end);                                       \</span>
<a name="l00694"></a>00694 <span class="preprocessor">        type * _q_f = (type *)(_begin);                                     \</span>
<a name="l00695"></a>00695 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                        \</span>
<a name="l00696"></a>00696 <span class="preprocessor">        type * _q_L = (head)-&gt;last;                                         \</span>
<a name="l00697"></a>00697 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                          \</span>
<a name="l00698"></a>00698 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                         \</span>
<a name="l00699"></a>00699 <span class="preprocessor">        if (_q_f &lt; _q_L) {                                                  \</span>
<a name="l00700"></a>00700 <span class="preprocessor">            memcpy(_q_f, _q_e, sizeof(type) * (_q_e - _q_f));               \</span>
<a name="l00701"></a>00701 <span class="preprocessor">            (head)-&gt;last = _q_L - (_q_e - _q_f);                            \</span>
<a name="l00702"></a>00702 <span class="preprocessor">        } else if (_q_e &lt; _q_E) {                                           \</span>
<a name="l00703"></a>00703 <span class="preprocessor">            memmove(_q_F + (_q_e - _q_f), _q_F,                             \</span>
<a name="l00704"></a>00704 <span class="preprocessor">                    sizeof(type) * (_q_f - _q_F));                          \</span>
<a name="l00705"></a>00705 <span class="preprocessor">            (head)-&gt;first = _q_F + (_q_e - _q_f);                           \</span>
<a name="l00706"></a>00706 <span class="preprocessor">        } else {                                                            \</span>
<a name="l00707"></a>00707 <span class="preprocessor">            size_t _q_n = _q_E - _q_f;                                      \</span>
<a name="l00708"></a>00708 <span class="preprocessor">            size_t _q_m = _q_L - _q_e;                                      \</span>
<a name="l00709"></a>00709 <span class="preprocessor">            if (_q_n &gt; _q_m) {                                              \</span>
<a name="l00710"></a>00710 <span class="preprocessor">                memcpy(_q_f, _q_e, sizeof(type) * _q_m);                    \</span>
<a name="l00711"></a>00711 <span class="preprocessor">                (head)-&gt;last = _q_f + _q_m;                                 \</span>
<a name="l00712"></a>00712 <span class="preprocessor">            } else {                                                        \</span>
<a name="l00713"></a>00713 <span class="preprocessor">                memcpy(_q_f, _q_e, sizeof(type) * _q_n);                    \</span>
<a name="l00714"></a>00714 <span class="preprocessor">                memcpy(_q_B, _q_e + _q_n, sizeof(type) * (_q_m - _q_n));    \</span>
<a name="l00715"></a>00715 <span class="preprocessor">                (head)-&gt;last = _q_B + (_q_m - _q_n);                        \</span>
<a name="l00716"></a>00716 <span class="preprocessor">            }                                                               \</span>
<a name="l00717"></a>00717 <span class="preprocessor">        }                                                                   \</span>
<a name="l00718"></a>00718 <span class="preprocessor">    } while (0)</span>
<a name="l00719"></a>00719 <span class="preprocessor"></span>
<a name="l00730"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga82383642bb62bc1a946511d8d249cfac">00730</a> <span class="preprocessor">#define dcseq_splice(type, dst, pos, src, _first, _last) do {               \</span>
<a name="l00731"></a>00731 <span class="preprocessor">        type * _q1_l = (_last);                                             \</span>
<a name="l00732"></a>00732 <span class="preprocessor">        type * _q1_f = (_first);                                            \</span>
<a name="l00733"></a>00733 <span class="preprocessor">        type * _q1_p = (pos);                                               \</span>
<a name="l00734"></a>00734 <span class="preprocessor">        type * _q1_B = (src)-&gt;base;                                         \</span>
<a name="l00735"></a>00735 <span class="preprocessor">        type * _q1_E = (src)-&gt;end;                                          \</span>
<a name="l00736"></a>00736 <span class="preprocessor">        size_t _q_cs[2] = {0, 0};                                           \</span>
<a name="l00737"></a>00737 <span class="preprocessor">        type * _q_ss[2] = {_q1_f, _q1_B};                                   \</span>
<a name="l00738"></a>00738 <span class="preprocessor">        int _q1_i, _q1_k;                                                   \</span>
<a name="l00739"></a>00739 <span class="preprocessor">        if (dst == src) break;                                              \</span>
<a name="l00740"></a>00740 <span class="preprocessor">        if (_q1_f &lt;= _q1_l)                                                 \</span>
<a name="l00741"></a>00741 <span class="preprocessor">            _q_cs[0] = _q1_l - _q1_f + 1;                                   \</span>
<a name="l00742"></a>00742 <span class="preprocessor">        else {                                                              \</span>
<a name="l00743"></a>00743 <span class="preprocessor">            _q_cs[0] = _q1_E - _q1_f;                                       \</span>
<a name="l00744"></a>00744 <span class="preprocessor">            _q_cs[1] = _q1_l - _q1_B + 1;                                   \</span>
<a name="l00745"></a>00745 <span class="preprocessor">            _q1_i = dcseq_index_of(dst, _q1_p) + _q_cs[0];                  \</span>
<a name="l00746"></a>00746 <span class="preprocessor">        }                                                                   \</span>
<a name="l00747"></a>00747 <span class="preprocessor">        for (_q1_k = 0; _q1_k &lt; 2 &amp;&amp; _q_cs[_q1_k]; ++_q1_k) {               \</span>
<a name="l00748"></a>00748 <span class="preprocessor">            dcseq_inserts(type, dst, _q1_p, _q_ss[_q1_k], _q_cs[_q1_k]);    \</span>
<a name="l00749"></a>00749 <span class="preprocessor">            if (_q_cs[1])                                                   \</span>
<a name="l00750"></a>00750 <span class="preprocessor">                _q1_p = dcseq_at(type, dst, _q1_i);                         \</span>
<a name="l00751"></a>00751 <span class="preprocessor">        }                                                                   \</span>
<a name="l00752"></a>00752 <span class="preprocessor">        dcseq_erases(type, src, _q1_f, __dcseq_next(_q1_B, _q1_E, _q1_l));  \</span>
<a name="l00753"></a>00753 <span class="preprocessor">    } while (0)</span>
<a name="l00754"></a>00754 <span class="preprocessor"></span>
<a name="l00771"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga3183dcaa0721b314454852a5d6b934d6">00771</a> <span class="preprocessor">#define dcseq_appends(type, head, src, cnt) do {                        \</span>
<a name="l00772"></a>00772 <span class="preprocessor">        size_t _q_c = (cnt);                                            \</span>
<a name="l00773"></a>00773 <span class="preprocessor">        type * _q_s = (type *)(src);                                    \</span>
<a name="l00774"></a>00774 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                      \</span>
<a name="l00775"></a>00775 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                     \</span>
<a name="l00776"></a>00776 <span class="preprocessor">        type * _q_L = (head)-&gt;last;                                     \</span>
<a name="l00777"></a>00777 <span class="preprocessor">        if (_q_L + _q_c &gt; _q_E) {                                       \</span>
<a name="l00778"></a>00778 <span class="preprocessor">            size_t _q_n = _q_E - _q_L;                                  \</span>
<a name="l00779"></a>00779 <span class="preprocessor">            memcpy(_q_L, _q_s, sizeof(type) * _q_n);                    \</span>
<a name="l00780"></a>00780 <span class="preprocessor">            memcpy(_q_B, _q_s + _q_n, sizeof(type) * (_q_c - _q_n));    \</span>
<a name="l00781"></a>00781 <span class="preprocessor">            (head)-&gt;last = _q_B + (_q_c - _q_n);                        \</span>
<a name="l00782"></a>00782 <span class="preprocessor">        } else {                                                        \</span>
<a name="l00783"></a>00783 <span class="preprocessor">            memcpy(_q_L, _q_s, sizeof(type) * _q_c);                    \</span>
<a name="l00784"></a>00784 <span class="preprocessor">            _q_L += _q_c;                                               \</span>
<a name="l00785"></a>00785 <span class="preprocessor">            if (_q_L == _q_E)                                           \</span>
<a name="l00786"></a>00786 <span class="preprocessor">                _q_L = _q_B;                                            \</span>
<a name="l00787"></a>00787 <span class="preprocessor">            (head)-&gt;last = _q_L;                                        \</span>
<a name="l00788"></a>00788 <span class="preprocessor">        }                                                               \</span>
<a name="l00789"></a>00789 <span class="preprocessor">    } while (0)</span>
<a name="l00790"></a>00790 <span class="preprocessor"></span>
<a name="l00798"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga261cb5811d552285e5848042c5f906a6">00798</a> <span class="preprocessor">#define dcseq_append(head, newly) \</span>
<a name="l00799"></a>00799 <span class="preprocessor">    (*((head)-&gt;last++) = (newly))</span>
<a name="l00800"></a>00800 <span class="preprocessor"></span>
<a name="l00816"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaf357cdeb311d5d2d7609c81c97c6a744">00816</a> <span class="preprocessor">#define dcseq_copy(type, dst, src) do {                                 \</span>
<a name="l00817"></a>00817 <span class="preprocessor">        type * _q_B = (src)-&gt;base;                                      \</span>
<a name="l00818"></a>00818 <span class="preprocessor">        type * _q_F = (src)-&gt;first;                                     \</span>
<a name="l00819"></a>00819 <span class="preprocessor">        type * _q_L = (src)-&gt;last;                                      \</span>
<a name="l00820"></a>00820 <span class="preprocessor">        type * _q_E = (src)-&gt;end;                                       \</span>
<a name="l00821"></a>00821 <span class="preprocessor">        type * _q_dB = (dst)-&gt;base;                                     \</span>
<a name="l00822"></a>00822 <span class="preprocessor">        if (_q_F &lt; _q_L) {                                              \</span>
<a name="l00823"></a>00823 <span class="preprocessor">            size_t _q_c = _q_L - _q_F;                                  \</span>
<a name="l00824"></a>00824 <span class="preprocessor">            memcpy(_q_dB, _q_F, sizeof(type) * (_q_L - _q_F));          \</span>
<a name="l00825"></a>00825 <span class="preprocessor">            (dst)-&gt;last = _q_dB + _q_c;                                 \</span>
<a name="l00826"></a>00826 <span class="preprocessor">        } else {                                                        \</span>
<a name="l00827"></a>00827 <span class="preprocessor">            size_t _q_c = _q_E - _q_F;                                  \</span>
<a name="l00828"></a>00828 <span class="preprocessor">            memcpy(_q_dB, _q_F, sizeof(type) * _q_c);                   \</span>
<a name="l00829"></a>00829 <span class="preprocessor">            memcpy(_q_dB + _q_c, _q_B, sizeof(type) * (_q_L - _q_B));   \</span>
<a name="l00830"></a>00830 <span class="preprocessor">            (dst)-&gt;last = _q_dB + (_q_c + (_q_L - _q_B));               \</span>
<a name="l00831"></a>00831 <span class="preprocessor">        }                                                               \</span>
<a name="l00832"></a>00832 <span class="preprocessor">        (dst)-&gt;first = _q_dB;                                           \</span>
<a name="l00833"></a>00833 <span class="preprocessor">    } while (0)</span>
<a name="l00834"></a>00834 <span class="preprocessor"></span>
<a name="l00847"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga642f3253dbeeff4f4eba5c1893204a2a">00847</a> <span class="preprocessor">#define dcseq_push_front(type, head) \</span>
<a name="l00848"></a>00848 <span class="preprocessor">    ((type *)dcseq_dec(head, (head)-&gt;first))</span>
<a name="l00849"></a>00849 <span class="preprocessor"></span>
<a name="l00862"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gabe68987046efd89e34fd3be135ae3892">00862</a> <span class="preprocessor">#define dcseq_push_back(type, head) \</span>
<a name="l00863"></a>00863 <span class="preprocessor">    dcseq_inc_later(type, head, (head)-&gt;last)</span>
<a name="l00864"></a>00864 <span class="preprocessor"></span>
<a name="l00877"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga308642d86d07048a845099ac670a3acb">00877</a> <span class="preprocessor">#define dcseq_pop_front(type, head) \</span>
<a name="l00878"></a>00878 <span class="preprocessor">    dcseq_inc_later(type, head, (head)-&gt;first)</span>
<a name="l00879"></a>00879 <span class="preprocessor"></span>
<a name="l00892"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaacd568e3509c4e7996aa15b60602ad1e">00892</a> <span class="preprocessor">#define dcseq_pop_back(type, head) \</span>
<a name="l00893"></a>00893 <span class="preprocessor">    ((type *)dcseq_dec(head, (head)-&gt;last))</span>
<a name="l00894"></a>00894 <span class="preprocessor"></span>
<a name="l00901"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5349cc1a47edf529216a59099a05d49a">00901</a> <span class="preprocessor">#define dcseq_iter_replace(victim, newly) (*(victim) = (newly))</span>
<a name="l00902"></a>00902 <span class="preprocessor"></span>
<a name="l00903"></a>00903 <span class="preprocessor">#define __dcseq_iter_swap(type, a, b) do {\</span>
<a name="l00904"></a>00904 <span class="preprocessor">    type _q_t = *(a); *(a) = *(b); *(b) = _q_t; } while (0)</span>
<a name="l00905"></a>00905 <span class="preprocessor"></span>
<a name="l00913"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga7f3dac7d3c6f0814b436407b0adce396">00913</a> <span class="preprocessor">#define dcseq_iter_swap(type, a, b) do {        \</span>
<a name="l00914"></a>00914 <span class="preprocessor">        type * _q_b = (b); type * _q_a = (a);   \</span>
<a name="l00915"></a>00915 <span class="preprocessor">        __dcseq_iter_swap(type, _q_a, _q_b);    \</span>
<a name="l00916"></a>00916 <span class="preprocessor">    } while (0)</span>
<a name="l00917"></a>00917 <span class="preprocessor"></span>
<a name="l00924"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5a2034fe041f6afb077925c7679fb424">00924</a> <span class="preprocessor">#define dcseq_replace(victim, newly) (*(victim) = *(newly))</span>
<a name="l00925"></a>00925 <span class="preprocessor"></span>
<a name="l00933"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga9312f46643026c0a60f7b3ae57a9a6ed">00933</a> <span class="preprocessor">#define dcseq_swap(type, a, b) do { \</span>
<a name="l00934"></a>00934 <span class="preprocessor">        dcseq_head(type) t = *(a);  \</span>
<a name="l00935"></a>00935 <span class="preprocessor">        *(a) = *(b); *(b) = t;      \</span>
<a name="l00936"></a>00936 <span class="preprocessor">    } while (0)</span>
<a name="l00937"></a>00937 <span class="preprocessor"></span>
<a name="l00944"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaf56b4267ee35cb8d76cc752efed76e81">00944</a> <span class="preprocessor">#define dcseq_front(head) ((head)-&gt;first)</span>
<a name="l00945"></a>00945 <span class="preprocessor"></span>
<a name="l00953"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga302b3de503cacadd24e475a0e21d401b">00953</a> <span class="preprocessor">#define dcseq_back(head) \</span>
<a name="l00954"></a>00954 <span class="preprocessor">    __dcseq_back((head)-&gt;base, (head)-&gt;last, (head)-&gt;end)</span>
<a name="l00955"></a>00955 <span class="preprocessor"></span>
<a name="l00956"></a>00956 <span class="preprocessor">#define __dcseq_back(base, last, end) \</span>
<a name="l00957"></a>00957 <span class="preprocessor">    (((last) &gt; (base))? ((last) - 1): ((end) - 1))</span>
<a name="l00958"></a>00958 <span class="preprocessor"></span>
<a name="l00975"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gafd47b3c616bf83cf88e38fc6afcad580">00975</a> <span class="preprocessor">#define dcseq_begin(head) dcseq_front(head)</span>
<a name="l00976"></a>00976 <span class="preprocessor"></span>
<a name="l00984"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaed55996a20f8e2bed24409fd5319ab96">00984</a> <span class="preprocessor">#define dcseq_end(head) ((head)-&gt;last)</span>
<a name="l00985"></a>00985 <span class="preprocessor"></span>
<a name="l00994"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga55d25c1e2a956becd038e3a4bcecfa1c">00994</a> <span class="preprocessor">#define dcseq_end_of(head, last) dcseq_next(head, last)</span>
<a name="l00995"></a>00995 <span class="preprocessor"></span>
<a name="l01003"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaf70ac85655acd46c15342ef107982ae9">01003</a> <span class="preprocessor">#define dcseq_rbegin(head) dcseq_back(head)</span>
<a name="l01004"></a>01004 <span class="preprocessor"></span>
<a name="l01011"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gafdbfa6d98f95af2063eac747ddfe9676">01011</a> <span class="preprocessor">#define dcseq_rend(head) dcseq_prev(head, (head)-&gt;first)</span>
<a name="l01012"></a>01012 <span class="preprocessor"></span>
<a name="l01021"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5b7a5959a31b5a4ddbe9d6e65ece1544">01021</a> <span class="preprocessor">#define dcseq_rend_of(head, rlast) dcseq_prev(head, rlast)</span>
<a name="l01022"></a>01022 <span class="preprocessor"></span>
<a name="l01031"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga2dfa4c22532771b34aeb2f5038fe1c88">01031</a> <span class="preprocessor">#define dcseq_next(head, itr) \</span>
<a name="l01032"></a>01032 <span class="preprocessor">    __dcseq_next((head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01033"></a>01033 <span class="preprocessor"></span>
<a name="l01034"></a>01034 <span class="preprocessor">#define __dcseq_next(base, end, itr) \</span>
<a name="l01035"></a>01035 <span class="preprocessor">    (((itr) + 1 &gt;= (end))? (base): ((itr) + 1))</span>
<a name="l01036"></a>01036 <span class="preprocessor"></span>
<a name="l01045"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga06745f62cd24f19e86230e73404026fe">01045</a> <span class="preprocessor">#define dcseq_prev(head, itr) \</span>
<a name="l01046"></a>01046 <span class="preprocessor">    __dcseq_prev((head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01047"></a>01047 <span class="preprocessor"></span>
<a name="l01048"></a>01048 <span class="preprocessor">#define __dcseq_prev(base, end, itr) \</span>
<a name="l01049"></a>01049 <span class="preprocessor">    (((itr) &lt; (base) + 1)? ((end) - 1): ((itr) - 1))</span>
<a name="l01050"></a>01050 <span class="preprocessor"></span>
<a name="l01060"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gabfbaee41c13bae986253b8e4e77d8028">01060</a> <span class="preprocessor">#define dcseq_advance(type, head, cur, dist) \</span>
<a name="l01061"></a>01061 <span class="preprocessor">    __dcseq_advance(type, (head)-&gt;base, (head)-&gt;end, (type *)(cur) + (dist))</span>
<a name="l01062"></a>01062 <span class="preprocessor"></span>
<a name="l01063"></a>01063 <span class="preprocessor">#define __dcseq_advance(type, base, end, dest) \</span>
<a name="l01064"></a>01064 <span class="preprocessor">    ((type *)__do_dcseq_advance((char*)(base), (char*)(end), (char*)(dest)))</span>
<a name="l01065"></a>01065 <span class="preprocessor"></span>
<a name="l01066"></a>01066 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_advance(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* end, <span class="keywordtype">char</span>* dest)
<a name="l01067"></a>01067 {
<a name="l01068"></a>01068     <span class="keywordflow">if</span> (dest &gt;= end)
<a name="l01069"></a>01069         <span class="keywordflow">return</span> base + (dest - end);
<a name="l01070"></a>01070     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dest &lt; base)
<a name="l01071"></a>01071         <span class="keywordflow">return</span> end - (base - dest);
<a name="l01072"></a>01072     <span class="keywordflow">else</span>
<a name="l01073"></a>01073         <span class="keywordflow">return</span> dest;
<a name="l01074"></a>01074 }
<a name="l01075"></a>01075 
<a name="l01100"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga5f13da69cb54c7f5770916783cb17fb0">01100</a> <span class="preprocessor">#define DCSEQ_NOT_END(itr, end)     ((itr) != (end))</span>
<a name="l01101"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gacbeb11dd8a7ba4d43d5e2e79ce685073">01101</a> <span class="preprocessor"></span><span class="preprocessor">#define DCSEQ_NOT_REND(itr, rend)   ((itr) != (rend))</span>
<a name="l01102"></a>01102 <span class="preprocessor"></span>
<a name="l01147"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga42572fa27232bd6618cb30487fa0be60">01147</a> <span class="preprocessor">#define dcseq_inc(head, itr)                __dcseq_inc((head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01148"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga835a40bc65b0348e544cbec9fac6b21f">01148</a> <span class="preprocessor"></span><span class="preprocessor">#define dcseq_dec(head, itr)                __dcseq_dec((head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01149"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga05ed4ffe76c677596202f75ba99b08af">01149</a> <span class="preprocessor"></span><span class="preprocessor">#define dcseq_add(type, head, itr, cnt)     __dcseq_add(type, (head)-&gt;base, (head)-&gt;end, itr, cnt)</span>
<a name="l01150"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga39400aabf3e01c763c2dad7042136de5">01150</a> <span class="preprocessor"></span><span class="preprocessor">#define dcseq_sub(type, head, itr, cnt)     __dcseq_sub(type, (head)-&gt;base, (head)-&gt;end, itr, cnt)</span>
<a name="l01151"></a>01151 <span class="preprocessor"></span>
<a name="l01152"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga2e02f51a06ed45c02d7d1426e46dedfa">01152</a> <span class="preprocessor">#define dcseq_inc_later(type, head, itr) \</span>
<a name="l01153"></a>01153 <span class="preprocessor">    __dcseq_inc_later(type, (head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01154"></a>01154 <span class="preprocessor"></span>
<a name="l01155"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gacbbb60170c5465e4b753f93684c43fbb">01155</a> <span class="preprocessor">#define dcseq_dec_later(type, head, itr) \</span>
<a name="l01156"></a>01156 <span class="preprocessor">    __dcseq_dec_later(type, (head)-&gt;base, (head)-&gt;end, itr)</span>
<a name="l01157"></a>01157 <span class="preprocessor"></span>
<a name="l01158"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga70206861e2a406862336cb2d96d36b49">01158</a> <span class="preprocessor">#define dcseq_add_later(type, head, itr, cnt) \</span>
<a name="l01159"></a>01159 <span class="preprocessor">    __dcseq_add_later(type, (head)-&gt;base, (head)-&gt;end, itr, cnt)</span>
<a name="l01160"></a>01160 <span class="preprocessor"></span>
<a name="l01161"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gad45f2e3f82642762d7846f633f22d5b2">01161</a> <span class="preprocessor">#define dcseq_sub_later(type, head, itr, cnt) \</span>
<a name="l01162"></a>01162 <span class="preprocessor">    __dcseq_sub_later(type, (head)-&gt;base, (head)-&gt;end, itr, cnt)</span>
<a name="l01163"></a>01163 <span class="preprocessor"></span>
<a name="l01164"></a>01164 <span class="preprocessor">#define __dcseq_inc(base, end, itr) ((itr) = __dcseq_next(base, end, itr))</span>
<a name="l01165"></a>01165 <span class="preprocessor"></span><span class="preprocessor">#define __dcseq_dec(base, end, itr) ((itr) = __dcseq_prev(base, end, itr))</span>
<a name="l01166"></a>01166 <span class="preprocessor"></span>
<a name="l01167"></a>01167 <span class="preprocessor">#define __dcseq_add(type, base, end, itr, cnt) \</span>
<a name="l01168"></a>01168 <span class="preprocessor">    ((itr) = __dcseq_advance(type, base, end, (itr) + (cnt)))</span>
<a name="l01169"></a>01169 <span class="preprocessor"></span><span class="preprocessor">#define __dcseq_sub(type, base, end, itr, cnt) \</span>
<a name="l01170"></a>01170 <span class="preprocessor">    ((itr) = __dcseq_advance(type, base, end, (itr) - (cnt)))</span>
<a name="l01171"></a>01171 <span class="preprocessor"></span>
<a name="l01172"></a>01172 <span class="preprocessor">#define __dcseq_inc_later(type, base, end, itr) \</span>
<a name="l01173"></a>01173 <span class="preprocessor">    ((type *)__do_dcseq_inc_later((char*)(base), (char*)(end), \</span>
<a name="l01174"></a>01174 <span class="preprocessor">            (char*)((itr) + 1), (char*)(itr), (char**)(&amp;(itr))))</span>
<a name="l01175"></a>01175 <span class="preprocessor"></span>
<a name="l01176"></a>01176 <span class="preprocessor">#define __dcseq_dec_later(type, base, end, itr) \</span>
<a name="l01177"></a>01177 <span class="preprocessor">    ((type *)__do_dcseq_dec_later((char*)(base), (char*)((type *)(end) - 1), \</span>
<a name="l01178"></a>01178 <span class="preprocessor">            (char*)((itr) - 1), (char*)(itr), (char**)(&amp;(itr))))</span>
<a name="l01179"></a>01179 <span class="preprocessor"></span>
<a name="l01180"></a>01180 <span class="preprocessor">#define __dcseq_add_later(type, base, end, itr, cnt) \</span>
<a name="l01181"></a>01181 <span class="preprocessor">    ((type *)__do_dcseq_add_sub_later((char*)(base), (char*)(end),  \</span>
<a name="l01182"></a>01182 <span class="preprocessor">            (char*)((itr) + (cnt)), (char*)(itr), (char**)(&amp;(itr))))</span>
<a name="l01183"></a>01183 <span class="preprocessor"></span>
<a name="l01184"></a>01184 <span class="preprocessor">#define __dcseq_sub_later(type, base, end, itr, cnt) \</span>
<a name="l01185"></a>01185 <span class="preprocessor">    ((type *)__do_dcseq_add_sub_later((char*)(base), (char*)(end),  \</span>
<a name="l01186"></a>01186 <span class="preprocessor">            (char*)((itr) - (cnt)), (char*)(itr), (char**)(&amp;(itr))))</span>
<a name="l01187"></a>01187 <span class="preprocessor"></span>
<a name="l01188"></a>01188 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_inc_later(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* end,
<a name="l01189"></a>01189                                          <span class="keywordtype">char</span>* dest, <span class="keywordtype">char</span>* cur,
<a name="l01190"></a>01190                                          <span class="keywordtype">char</span>** p)
<a name="l01191"></a>01191 {
<a name="l01192"></a>01192     *p = (dest &gt;= end)? base: dest;
<a name="l01193"></a>01193     <span class="keywordflow">return</span> cur;
<a name="l01194"></a>01194 }
<a name="l01195"></a>01195 
<a name="l01196"></a>01196 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_dec_later(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* nend,
<a name="l01197"></a>01197                                          <span class="keywordtype">char</span>* dest, <span class="keywordtype">char</span>* cur,
<a name="l01198"></a>01198                                          <span class="keywordtype">char</span>** p)
<a name="l01199"></a>01199 {
<a name="l01200"></a>01200     *p = (dest &lt; base)? nend: dest;
<a name="l01201"></a>01201     <span class="keywordflow">return</span> cur;
<a name="l01202"></a>01202 }
<a name="l01203"></a>01203 
<a name="l01204"></a>01204 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* __do_dcseq_add_sub_later(<span class="keywordtype">char</span>* base, <span class="keywordtype">char</span>* end,
<a name="l01205"></a>01205                                              <span class="keywordtype">char</span>* dest, <span class="keywordtype">char</span>* cur,
<a name="l01206"></a>01206                                              <span class="keywordtype">char</span>** p)
<a name="l01207"></a>01207 {
<a name="l01208"></a>01208     *p = __do_dcseq_advance(base, end, dest);
<a name="l01209"></a>01209     <span class="keywordflow">return</span> cur;
<a name="l01210"></a>01210 }
<a name="l01211"></a>01211 
<a name="l01223"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga597993b699fe8ad8ad2684ed4be30341">01223</a> <span class="preprocessor">#define dcseq_iter_less(first, last, itr1, itr2) \</span>
<a name="l01224"></a>01224 <span class="preprocessor">    __dcseq_iter_less((char*)(first), (char*)(last), \</span>
<a name="l01225"></a>01225 <span class="preprocessor">                      (char*)(itr1), (char*)(itr2))</span>
<a name="l01226"></a>01226 <span class="preprocessor"></span>
<a name="l01227"></a>01227 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_iter_less(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last,
<a name="l01228"></a>01228                                     <span class="keywordtype">char</span>* itr1, <span class="keywordtype">char</span>* itr2)
<a name="l01229"></a>01229 {
<a name="l01230"></a>01230     <span class="keywordflow">if</span> ((itr1 &lt; itr2 &amp;&amp; (first &lt;= last || itr1 &gt;= first || itr2 &lt;= last)) ||
<a name="l01231"></a>01231         (itr1 &gt; itr2 &amp;&amp; first &gt; last &amp;&amp; itr1 &gt;= first &amp;&amp; itr2 &lt;= last))
<a name="l01232"></a>01232         <span class="keywordflow">return</span> 1;
<a name="l01233"></a>01233     <span class="keywordflow">else</span>
<a name="l01234"></a>01234         <span class="keywordflow">return</span> 0;
<a name="l01235"></a>01235 }
<a name="l01236"></a>01236 
<a name="l01248"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga2362e4de1dc10f118af111cfca83bc40">01248</a> <span class="preprocessor">#define dcseq_iter_less_equal(first, last, itr1, itr2) \</span>
<a name="l01249"></a>01249 <span class="preprocessor">    __dcseq_iter_less_equal((char*)(first), (char*)(last), \</span>
<a name="l01250"></a>01250 <span class="preprocessor">                            (char*)(itr1), (char*)(itr2))</span>
<a name="l01251"></a>01251 <span class="preprocessor"></span>
<a name="l01252"></a>01252 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_iter_less_equal(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last,
<a name="l01253"></a>01253                                           <span class="keywordtype">char</span>* itr1, <span class="keywordtype">char</span>* itr2)
<a name="l01254"></a>01254 {
<a name="l01255"></a>01255     <span class="keywordflow">if</span> (itr1 == itr2 ||
<a name="l01256"></a>01256         (itr1 &lt; itr2 &amp;&amp; (first &lt;= last || itr1 &gt;= first || itr2 &lt;= last)) ||
<a name="l01257"></a>01257         (itr1 &gt; itr2 &amp;&amp; first &gt; last &amp;&amp; itr1 &gt;= first &amp;&amp; itr2 &lt;= last))
<a name="l01258"></a>01258         <span class="keywordflow">return</span> 1;
<a name="l01259"></a>01259     <span class="keywordflow">else</span>
<a name="l01260"></a>01260         <span class="keywordflow">return</span> 0;
<a name="l01261"></a>01261 }
<a name="l01262"></a>01262 
<a name="l01274"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaffb6790b6ba112981a975fbc1fd3b10e">01274</a> <span class="preprocessor">#define dcseq_iter_greater(first, last, itr1, itr2) \</span>
<a name="l01275"></a>01275 <span class="preprocessor">    __dcseq_iter_greater((char*)(first), (char*)(last), \</span>
<a name="l01276"></a>01276 <span class="preprocessor">                         (char*)(itr1), (char*)(itr2))</span>
<a name="l01277"></a>01277 <span class="preprocessor"></span>
<a name="l01278"></a>01278 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_iter_greater(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last,
<a name="l01279"></a>01279                                        <span class="keywordtype">char</span>* itr1, <span class="keywordtype">char</span>* itr2)
<a name="l01280"></a>01280 {
<a name="l01281"></a>01281     <span class="keywordflow">if</span> ((itr1 &gt; itr2 &amp;&amp; (first &lt;= last || itr2 &gt;= first || itr1 &lt;= last)) ||
<a name="l01282"></a>01282         (itr1 &lt; itr2 &amp;&amp; first &gt; last &amp;&amp; itr2 &gt;= first &amp;&amp; itr1 &lt;= last))
<a name="l01283"></a>01283         <span class="keywordflow">return</span> 1;
<a name="l01284"></a>01284     <span class="keywordflow">else</span>
<a name="l01285"></a>01285         <span class="keywordflow">return</span> 0;
<a name="l01286"></a>01286 }
<a name="l01287"></a>01287 
<a name="l01299"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gad777d40b5430cd03c03c09c32e57c5e7">01299</a> <span class="preprocessor">#define dcseq_iter_greater_equal(first, last, itr1, itr2) \</span>
<a name="l01300"></a>01300 <span class="preprocessor">    __dcseq_iter_greater_equal((char*)(first), (char*)(last), \</span>
<a name="l01301"></a>01301 <span class="preprocessor">                               (char*)(itr1), (char*)(itr2))</span>
<a name="l01302"></a>01302 <span class="preprocessor"></span>
<a name="l01303"></a>01303 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dcseq_iter_greater_equal(<span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* last,
<a name="l01304"></a>01304                                              <span class="keywordtype">char</span>* itr1, <span class="keywordtype">char</span>* itr2)
<a name="l01305"></a>01305 {
<a name="l01306"></a>01306     <span class="keywordflow">if</span> (itr1 == itr2 ||
<a name="l01307"></a>01307         (itr1 &gt; itr2 &amp;&amp; (first &lt;= last || itr2 &gt;= first || itr1 &lt;= last)) ||
<a name="l01308"></a>01308         (itr1 &lt; itr2 &amp;&amp; first &gt; last &amp;&amp; itr2 &gt;= first &amp;&amp; itr1 &lt;= last))
<a name="l01309"></a>01309         <span class="keywordflow">return</span> 1;
<a name="l01310"></a>01310     <span class="keywordflow">else</span>
<a name="l01311"></a>01311         <span class="keywordflow">return</span> 0;
<a name="l01312"></a>01312 }
<a name="l01313"></a>01313 
<a name="l01324"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gac2168edcbae3122bbe1292262c2d780a">01324</a> <span class="preprocessor">#define dcseq_foreach(type, head, begin, _end, fn)  \</span>
<a name="l01325"></a>01325 <span class="preprocessor">    do {type* _q_B = (head)-&gt;base;                  \</span>
<a name="l01326"></a>01326 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                   \</span>
<a name="l01327"></a>01327 <span class="preprocessor">        type * _q_e = (type *)(_end);               \</span>
<a name="l01328"></a>01328 <span class="preprocessor">        type * _q_f = (type *)(begin);              \</span>
<a name="l01329"></a>01329 <span class="preprocessor">        while (_q_f != _q_e) {                      \</span>
<a name="l01330"></a>01330 <span class="preprocessor">            fn(_q_f);                               \</span>
<a name="l01331"></a>01331 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_f);          \</span>
<a name="l01332"></a>01332 <span class="preprocessor">        }                                           \</span>
<a name="l01333"></a>01333 <span class="preprocessor">    } while(0)</span>
<a name="l01334"></a>01334 <span class="preprocessor"></span>
<a name="l01345"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gae3989307be034e738fe1921b441056d0">01345</a> <span class="preprocessor">#define dcseq_reverse_foreach(type, head, rbegin, rend, fn) \</span>
<a name="l01346"></a>01346 <span class="preprocessor">    do {type* _q_B = (head)-&gt;base;                  \</span>
<a name="l01347"></a>01347 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                   \</span>
<a name="l01348"></a>01348 <span class="preprocessor">        type * _q_e = (type *)(rend);               \</span>
<a name="l01349"></a>01349 <span class="preprocessor">        type * _q_f = (type *)(rbegin);             \</span>
<a name="l01350"></a>01350 <span class="preprocessor">        while (_q_f != _q_e) {                      \</span>
<a name="l01351"></a>01351 <span class="preprocessor">            fn(_q_f);                               \</span>
<a name="l01352"></a>01352 <span class="preprocessor">            __dcseq_dec(_q_B, _q_E, _q_f);          \</span>
<a name="l01353"></a>01353 <span class="preprocessor">        }                                           \</span>
<a name="l01354"></a>01354 <span class="preprocessor">    } while(0)</span>
<a name="l01355"></a>01355 <span class="preprocessor"></span>
<a name="l01369"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga0481383b88b1a7f232120f776872a7d4">01369</a> <span class="preprocessor">#define dcseq_search(type, head, begin, _end, equal, var, res) \</span>
<a name="l01370"></a>01370 <span class="preprocessor">    do {type _q_t = (var);                              \</span>
<a name="l01371"></a>01371 <span class="preprocessor">        type * _q_e = (_end);                           \</span>
<a name="l01372"></a>01372 <span class="preprocessor">        type * _q_f = (begin);                          \</span>
<a name="l01373"></a>01373 <span class="preprocessor">        type* _q_B = (head)-&gt;base;                      \</span>
<a name="l01374"></a>01374 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                       \</span>
<a name="l01375"></a>01375 <span class="preprocessor">        (res) = NULL;                                   \</span>
<a name="l01376"></a>01376 <span class="preprocessor">        while (_q_f != _q_e) {                          \</span>
<a name="l01377"></a>01377 <span class="preprocessor">            if (equal(_q_f, (&amp;_q_t))) {                 \</span>
<a name="l01378"></a>01378 <span class="preprocessor">                (res) = _q_f;                           \</span>
<a name="l01379"></a>01379 <span class="preprocessor">                break;                                  \</span>
<a name="l01380"></a>01380 <span class="preprocessor">            }                                           \</span>
<a name="l01381"></a>01381 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_f);              \</span>
<a name="l01382"></a>01382 <span class="preprocessor">        }                                               \</span>
<a name="l01383"></a>01383 <span class="preprocessor">    } while (0)</span>
<a name="l01384"></a>01384 <span class="preprocessor"></span>
<a name="l01398"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaa6ab92ee8678331df3af5f4c2f8e281d">01398</a> <span class="preprocessor">#define dcseq_binary_search(type, head, begin, _end, greater, var, res) \</span>
<a name="l01399"></a>01399 <span class="preprocessor">    do {type _q_t = (var);                                          \</span>
<a name="l01400"></a>01400 <span class="preprocessor">        type * _q_e = (_end);                                       \</span>
<a name="l01401"></a>01401 <span class="preprocessor">        type * _q_f = (begin);                                      \</span>
<a name="l01402"></a>01402 <span class="preprocessor">        type* _q_B = (head)-&gt;base;                                  \</span>
<a name="l01403"></a>01403 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                                   \</span>
<a name="l01404"></a>01404 <span class="preprocessor">        int _q_s = _q_E - _q_B;                                     \</span>
<a name="l01405"></a>01405 <span class="preprocessor">        (res) = NULL;                                               \</span>
<a name="l01406"></a>01406 <span class="preprocessor">        while (_q_f != _q_e) {                                      \</span>
<a name="l01407"></a>01407 <span class="preprocessor">            type * _q_m = __dcseq_advance(type, _q_B, _q_E, _q_f +  \</span>
<a name="l01408"></a>01408 <span class="preprocessor">                ((__dcseq_distance(_q_s, _q_e - _q_f) - 1) &gt;&gt; 1));  \</span>
<a name="l01409"></a>01409 <span class="preprocessor">            if (greater(_q_m, (&amp;_q_t)))                             \</span>
<a name="l01410"></a>01410 <span class="preprocessor">                _q_e = _q_m;                                        \</span>
<a name="l01411"></a>01411 <span class="preprocessor">            else if (greater((&amp;_q_t), _q_m))                        \</span>
<a name="l01412"></a>01412 <span class="preprocessor">                _q_f = __dcseq_next(_q_B, _q_E, _q_m);              \</span>
<a name="l01413"></a>01413 <span class="preprocessor">            else {                                                  \</span>
<a name="l01414"></a>01414 <span class="preprocessor">                (res) = _q_m;                                       \</span>
<a name="l01415"></a>01415 <span class="preprocessor">                break;                                              \</span>
<a name="l01416"></a>01416 <span class="preprocessor">            }                                                       \</span>
<a name="l01417"></a>01417 <span class="preprocessor">        }                                                           \</span>
<a name="l01418"></a>01418 <span class="preprocessor">    } while (0)</span>
<a name="l01419"></a>01419 <span class="preprocessor"></span>
<a name="l01420"></a>01420 <span class="comment">/* 反转序表的两种方式：</span>
<a name="l01421"></a>01421 <span class="comment"> * (1) 直接使用 dcseq_reverse(元素类型, head); (推荐)</span>
<a name="l01422"></a>01422 <span class="comment"> * (2) 按照如下方式迭代</span>
<a name="l01423"></a>01423 <span class="comment"> *     dcseq_iter(int) i = dcseq_vbegin(head);</span>
<a name="l01424"></a>01424 <span class="comment"> *     dcseq_iter(int) j = dcseq_rvbegin(head);</span>
<a name="l01425"></a>01425 <span class="comment"> *     dcseq_iter(int) e = dcseq_vend(int, head);</span>
<a name="l01426"></a>01426 <span class="comment"> *     while (i != e) {</span>
<a name="l01427"></a>01427 <span class="comment"> *          dcseq_vswap(int, i, j);</span>
<a name="l01428"></a>01428 <span class="comment"> *     }</span>
<a name="l01429"></a>01429 <span class="comment"> *     当迭代完成时，反转完成</span>
<a name="l01430"></a>01430 <span class="comment"> */</span>
<a name="l01431"></a>01431 
<a name="l01453"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga49f9bab17c77a6f8e851ea9ca1eee12b">01453</a> <span class="preprocessor">#define dcseq_vbegin(head)      dcseq_begin(head)</span>
<a name="l01454"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga532f7a370d2929d520056156408fc0dc">01454</a> <span class="preprocessor"></span><span class="preprocessor">#define dcseq_rvbegin(head)     dcseq_rbegin(head)</span>
<a name="l01455"></a>01455 <span class="preprocessor"></span>
<a name="l01474"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga7833ddc71d73f5beb56f52a35dbbc274">01474</a> <span class="preprocessor">#define dcseq_vend(type, head) \</span>
<a name="l01475"></a>01475 <span class="preprocessor">    dcseq_at(type, head, dcseq_count(head) &gt;&gt; 1)</span>
<a name="l01476"></a>01476 <span class="preprocessor"></span>
<a name="l01477"></a>01477 <span class="preprocessor">#define __dcseq_vnext(base, end, i, r) do { \</span>
<a name="l01478"></a>01478 <span class="preprocessor">        __dcseq_inc(base, end, i);          \</span>
<a name="l01479"></a>01479 <span class="preprocessor">        __dcseq_dec(base, end, r);          \</span>
<a name="l01480"></a>01480 <span class="preprocessor">    } while (0)</span>
<a name="l01481"></a>01481 <span class="preprocessor"></span>
<a name="l01482"></a>01482 <span class="preprocessor">#define dcseq_vnext(head, i, r) do {    \</span>
<a name="l01483"></a>01483 <span class="preprocessor">        dcseq_inc(head, i);             \</span>
<a name="l01484"></a>01484 <span class="preprocessor">        dcseq_dec(head, r);             \</span>
<a name="l01485"></a>01485 <span class="preprocessor">    } while (0)</span>
<a name="l01486"></a>01486 <span class="preprocessor"></span>
<a name="l01487"></a>01487 <span class="preprocessor">#define __dcseq_vswap(type, base, end, i, r) do {   \</span>
<a name="l01488"></a>01488 <span class="preprocessor">        __dcseq_iter_swap(type, i, r);              \</span>
<a name="l01489"></a>01489 <span class="preprocessor">        __dcseq_vnext(base, end, i, r);             \</span>
<a name="l01490"></a>01490 <span class="preprocessor">    } while (0)</span>
<a name="l01491"></a>01491 <span class="preprocessor"></span>
<a name="l01511"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga4980e41e8bf7f890effe770d4ddd75a9">01511</a> <span class="preprocessor">#define dcseq_vswap(type, head, i, r) do {  \</span>
<a name="l01512"></a>01512 <span class="preprocessor">        __dcseq_iter_swap(type, i, r);      \</span>
<a name="l01513"></a>01513 <span class="preprocessor">        dcseq_vnext(head, i, r);            \</span>
<a name="l01514"></a>01514 <span class="preprocessor">    } while (0)</span>
<a name="l01515"></a>01515 <span class="preprocessor"></span>
<a name="l01523"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gae1c00c20f6e35304548845e17f56d625">01523</a> <span class="preprocessor">#define dcseq_reverse(type, head) do {                      \</span>
<a name="l01524"></a>01524 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                         \</span>
<a name="l01525"></a>01525 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                          \</span>
<a name="l01526"></a>01526 <span class="preprocessor">        type * _q_e = dcseq_vend(type, head);               \</span>
<a name="l01527"></a>01527 <span class="preprocessor">        type * _q_i = dcseq_vbegin(head);                   \</span>
<a name="l01528"></a>01528 <span class="preprocessor">        type * _q_j = dcseq_rvbegin(head);                  \</span>
<a name="l01529"></a>01529 <span class="preprocessor">        while (_q_i != _q_e)                                \</span>
<a name="l01530"></a>01530 <span class="preprocessor">            __dcseq_vswap(type, _q_B, _q_E, _q_i, _q_j);    \</span>
<a name="l01531"></a>01531 <span class="preprocessor">    } while (0)</span>
<a name="l01532"></a>01532 <span class="preprocessor"></span>
<a name="l01541"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga87879cbca6e59c75ef488c453d75c76e">01541</a> <span class="preprocessor">#define dcseq_serialize(type, head, buf) do {           \</span>
<a name="l01542"></a>01542 <span class="preprocessor">        type * _q_d = (type *)(buf);                    \</span>
<a name="l01543"></a>01543 <span class="preprocessor">        type * _q_f = (head)-&gt;first;                    \</span>
<a name="l01544"></a>01544 <span class="preprocessor">        type * _q_e = (head)-&gt;end;                      \</span>
<a name="l01545"></a>01545 <span class="preprocessor">        size_t _q_c = dcseq_count(head);                \</span>
<a name="l01546"></a>01546 <span class="preprocessor">        if (_q_f + _q_c &gt; _q_e) {                       \</span>
<a name="l01547"></a>01547 <span class="preprocessor">            size_t _q_fs = _q_e - _q_f;                 \</span>
<a name="l01548"></a>01548 <span class="preprocessor">            memcpy(_q_d, _q_f, sizeof(type) * _q_fs);   \</span>
<a name="l01549"></a>01549 <span class="preprocessor">            memcpy(_q_d + _q_fs, (head)-&gt;base,          \</span>
<a name="l01550"></a>01550 <span class="preprocessor">                   sizeof(type) * (_q_c - _q_fs));      \</span>
<a name="l01551"></a>01551 <span class="preprocessor">        } else                                          \</span>
<a name="l01552"></a>01552 <span class="preprocessor">            memcpy(_q_d, _q_f, sizeof(type) * _q_c);    \</span>
<a name="l01553"></a>01553 <span class="preprocessor">    } while (0)</span>
<a name="l01554"></a>01554 <span class="preprocessor"></span>
<a name="l01565"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga1bbbab45a7cd2e7fb868901876fcf2de">01565</a> <span class="preprocessor">#define dcseq_fill(type, head, begin, _end, val) do {   \</span>
<a name="l01566"></a>01566 <span class="preprocessor">        type _q_v = (val);                              \</span>
<a name="l01567"></a>01567 <span class="preprocessor">        type* _q_B = (head)-&gt;base;                      \</span>
<a name="l01568"></a>01568 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                       \</span>
<a name="l01569"></a>01569 <span class="preprocessor">        type * _q_e = (type *)(_end);                   \</span>
<a name="l01570"></a>01570 <span class="preprocessor">        type * _q_f = (type *)(begin);                  \</span>
<a name="l01571"></a>01571 <span class="preprocessor">        while (_q_f != _q_e) {                          \</span>
<a name="l01572"></a>01572 <span class="preprocessor">            *_q_f = _q_v;                               \</span>
<a name="l01573"></a>01573 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_f);              \</span>
<a name="l01574"></a>01574 <span class="preprocessor">        }                                               \</span>
<a name="l01575"></a>01575 <span class="preprocessor">    } while(0)</span>
<a name="l01576"></a>01576 <span class="preprocessor"></span>
<a name="l01587"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga09978a995c2812e161379bcb5dfcbac7">01587</a> <span class="preprocessor">#define dcseq_generate(type, head, begin, _end, generator) \</span>
<a name="l01588"></a>01588 <span class="preprocessor">    do {type* _q_B = (head)-&gt;base;                  \</span>
<a name="l01589"></a>01589 <span class="preprocessor">        type* _q_E = (head)-&gt;end;                   \</span>
<a name="l01590"></a>01590 <span class="preprocessor">        type * _q_e = (type *)(_end);               \</span>
<a name="l01591"></a>01591 <span class="preprocessor">        type * _q_f = (type *)(begin);              \</span>
<a name="l01592"></a>01592 <span class="preprocessor">        while (_q_f != _q_e) {                      \</span>
<a name="l01593"></a>01593 <span class="preprocessor">            *_q_f = (generator);                    \</span>
<a name="l01594"></a>01594 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_f);          \</span>
<a name="l01595"></a>01595 <span class="preprocessor">        }                                           \</span>
<a name="l01596"></a>01596 <span class="preprocessor">    } while(0)</span>
<a name="l01597"></a>01597 <span class="preprocessor"></span>
<a name="l01611"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga99199c778b2eef7b69782e9d8162b8ba">01611</a> <span class="preprocessor">#define dcseq_is_heap(type, head, begin, _end, greater, res) do {               \</span>
<a name="l01612"></a>01612 <span class="preprocessor">        type * _q_e = (_end);                                                   \</span>
<a name="l01613"></a>01613 <span class="preprocessor">        type * _q_p = (begin);                                                  \</span>
<a name="l01614"></a>01614 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                             \</span>
<a name="l01615"></a>01615 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                              \</span>
<a name="l01616"></a>01616 <span class="preprocessor">        size_t _q_d = (__dcseq_distance(_q_E - _q_B, _q_e - _q_p) - 2) &gt;&gt; 1;    \</span>
<a name="l01617"></a>01617 <span class="preprocessor">        type * _q_i = __dcseq_next(_q_B, _q_E, _q_p);                           \</span>
<a name="l01618"></a>01618 <span class="preprocessor">        for ((res) = 1; _q_d--; _q_p = __dcseq_next(_q_B, _q_E, _q_p)) {        \</span>
<a name="l01619"></a>01619 <span class="preprocessor">            __dcseq_ret_gt(_q_B, _q_E, _q_i, _q_p, res, greater);               \</span>
<a name="l01620"></a>01620 <span class="preprocessor">            __dcseq_ret_gt(_q_B, _q_E, _q_i, _q_p, res, greater);               \</span>
<a name="l01621"></a>01621 <span class="preprocessor">        }                                                                       \</span>
<a name="l01622"></a>01622 <span class="preprocessor">        if (_q_i != _q_e &amp;&amp; (greater(_q_i, _q_p))) {                            \</span>
<a name="l01623"></a>01623 <span class="preprocessor">            (res) = 0; break;                                                   \</span>
<a name="l01624"></a>01624 <span class="preprocessor">        }                                                                       \</span>
<a name="l01625"></a>01625 <span class="preprocessor">    } while (0)</span>
<a name="l01626"></a>01626 <span class="preprocessor"></span>
<a name="l01627"></a>01627 <span class="preprocessor">#define __dcseq_ret_gt(B, E, i, j, r, greater) \</span>
<a name="l01628"></a>01628 <span class="preprocessor">    if (greater((i), (j))) { (r) = 0; break; } __dcseq_inc(B, E, i)</span>
<a name="l01629"></a>01629 <span class="preprocessor"></span>
<a name="l01648"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga24e87cd87cd11ac60d3b65941060c3cf">01648</a> <span class="preprocessor">#define dcseq_push_heap(type, head, begin, _end, greater) do {              \</span>
<a name="l01649"></a>01649 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                        \</span>
<a name="l01650"></a>01650 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                         \</span>
<a name="l01651"></a>01651 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                          \</span>
<a name="l01652"></a>01652 <span class="preprocessor">        size_t _q_i = __dcseq_distance(_q_E - _q_B, (_end) - (begin)) - 2;  \</span>
<a name="l01653"></a>01653 <span class="preprocessor">        size_t _q_p = (_q_i - 1) &gt;&gt; 1;                                      \</span>
<a name="l01654"></a>01654 <span class="preprocessor">        type * _q_ib = __dcseq_at(type, _q_B, _q_E, _q_F + _q_i);           \</span>
<a name="l01655"></a>01655 <span class="preprocessor">        type * _q_pb = __dcseq_at(type, _q_B, _q_E, _q_F + _q_p);           \</span>
<a name="l01656"></a>01656 <span class="preprocessor">        type _q_t = *_q_ib;                                                 \</span>
<a name="l01657"></a>01657 <span class="preprocessor">        while (_q_i &amp;&amp; (greater((&amp;_q_t), _q_pb))) {                         \</span>
<a name="l01658"></a>01658 <span class="preprocessor">            *_q_ib = *_q_pb;                                                \</span>
<a name="l01659"></a>01659 <span class="preprocessor">            _q_ib = _q_pb;                                                  \</span>
<a name="l01660"></a>01660 <span class="preprocessor">            _q_i = _q_p;                                                    \</span>
<a name="l01661"></a>01661 <span class="preprocessor">            _q_p = (_q_p - 1) &gt;&gt; 1;                                         \</span>
<a name="l01662"></a>01662 <span class="preprocessor">            _q_pb = __dcseq_at(type, _q_B, _q_E, _q_F + _q_p);              \</span>
<a name="l01663"></a>01663 <span class="preprocessor">        }                                                                   \</span>
<a name="l01664"></a>01664 <span class="preprocessor">        *_q_ib = _q_t;                                                      \</span>
<a name="l01665"></a>01665 <span class="preprocessor">    } while (0)</span>
<a name="l01666"></a>01666 <span class="preprocessor"></span>
<a name="l01683"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga3806407289a20307435660eb285ed540">01683</a> <span class="preprocessor">#define dcseq_pop_heap(type, head, begin, _end, greater) do {           \</span>
<a name="l01684"></a>01684 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                     \</span>
<a name="l01685"></a>01685 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                      \</span>
<a name="l01686"></a>01686 <span class="preprocessor">        __dcseq_pop_heap(type, _q_B, _q_E, begin, _end, greater);       \</span>
<a name="l01687"></a>01687 <span class="preprocessor">    } while (0)</span>
<a name="l01688"></a>01688 <span class="preprocessor"></span>
<a name="l01689"></a>01689 <span class="preprocessor">#define __dcseq_pop_heap(type, base, _End, begin, _end, greater) do {       \</span>
<a name="l01690"></a>01690 <span class="preprocessor">        type * _q_l = (type *)(_end);                                       \</span>
<a name="l01691"></a>01691 <span class="preprocessor">        type * _q_F = (type *)(begin);                                      \</span>
<a name="l01692"></a>01692 <span class="preprocessor">        type * _q_ib, * _q_jb, * _q_f = _q_F;                               \</span>
<a name="l01693"></a>01693 <span class="preprocessor">        type _q_t = *_q_f;                                                  \</span>
<a name="l01694"></a>01694 <span class="preprocessor">        size_t _q_L, _q_p = 0, _q_j = 2;                                    \</span>
<a name="l01695"></a>01695 <span class="preprocessor">        __dcseq_dec(base, _End, _q_l);                                      \</span>
<a name="l01696"></a>01696 <span class="preprocessor">        _q_L = __dcseq_distance(_End - base, _q_l - _q_F) - 1;              \</span>
<a name="l01697"></a>01697 <span class="preprocessor">        for (; _q_j &lt;= _q_L; _q_j = (_q_p + 1) &lt;&lt; 1) {                      \</span>
<a name="l01698"></a>01698 <span class="preprocessor">            _q_jb = __dcseq_at(type, base, _End, _q_F + _q_j);              \</span>
<a name="l01699"></a>01699 <span class="preprocessor">            _q_ib = __dcseq_prev(base, _End, _q_jb);                        \</span>
<a name="l01700"></a>01700 <span class="preprocessor">            if (greater(_q_jb, _q_ib)) {                                    \</span>
<a name="l01701"></a>01701 <span class="preprocessor">                *_q_f = *_q_jb;                                             \</span>
<a name="l01702"></a>01702 <span class="preprocessor">                _q_f = _q_jb;                                               \</span>
<a name="l01703"></a>01703 <span class="preprocessor">                _q_p = _q_j;                                                \</span>
<a name="l01704"></a>01704 <span class="preprocessor">            } else {                                                        \</span>
<a name="l01705"></a>01705 <span class="preprocessor">                *_q_f = *_q_ib;                                             \</span>
<a name="l01706"></a>01706 <span class="preprocessor">                _q_f = _q_ib;                                               \</span>
<a name="l01707"></a>01707 <span class="preprocessor">                _q_p = _q_j - 1;                                            \</span>
<a name="l01708"></a>01708 <span class="preprocessor">            }                                                               \</span>
<a name="l01709"></a>01709 <span class="preprocessor">        }                                                                   \</span>
<a name="l01710"></a>01710 <span class="preprocessor">        _q_jb = __dcseq_at(type, base, _End, _q_F + ((_q_p - 1) &gt;&gt; 1));     \</span>
<a name="l01711"></a>01711 <span class="preprocessor">        if (greater(_q_l, _q_jb)) {                                         \</span>
<a name="l01712"></a>01712 <span class="preprocessor">            *_q_f = *_q_jb;                                                 \</span>
<a name="l01713"></a>01713 <span class="preprocessor">            *_q_jb = *_q_l;                                                 \</span>
<a name="l01714"></a>01714 <span class="preprocessor">        } else                                                              \</span>
<a name="l01715"></a>01715 <span class="preprocessor">            *_q_f = *_q_l;                                                  \</span>
<a name="l01716"></a>01716 <span class="preprocessor">        *_q_l = _q_t;                                                       \</span>
<a name="l01717"></a>01717 <span class="preprocessor">    } while (0)</span>
<a name="l01718"></a>01718 <span class="preprocessor"></span>
<a name="l01719"></a>01719 <span class="comment">/* 下滤调整：</span>
<a name="l01720"></a>01720 <span class="comment"> * (1)将first记为parent节点.</span>
<a name="l01721"></a>01721 <span class="comment"> * (2)若parent节点有两个子节点，则选出值最大节点，记为max，</span>
<a name="l01722"></a>01722 <span class="comment"> *    若parent节点仅一个子节点，则选唯一节点为最大节点，记为max，</span>
<a name="l01723"></a>01723 <span class="comment"> *    若parent节点没有子节点，则退出算法.</span>
<a name="l01724"></a>01724 <span class="comment"> * (3)若parent节点的值大于等于max节点的值，则退出算法.</span>
<a name="l01725"></a>01725 <span class="comment"> * (4)将max节点与parent节点的值进行交换.</span>
<a name="l01726"></a>01726 <span class="comment"> * (5)将max节点记为parent节点，转(2).</span>
<a name="l01727"></a>01727 <span class="comment"> * greater(i, j) 最大堆 =&gt; (*i &gt; *j) 最小堆 =&gt; (*i &lt; *j)</span>
<a name="l01728"></a>01728 <span class="comment"> */</span>
<a name="l01729"></a>01729 <span class="preprocessor">#define __dcseq_adjust_heap(type, base, end, begin, first, last, greater) \</span>
<a name="l01730"></a>01730 <span class="preprocessor">    do {size_t _q_j = ((first) + 1) &lt;&lt; 1;                               \</span>
<a name="l01731"></a>01731 <span class="preprocessor">        type * _q_pb = __dcseq_at(type, base, end, (begin) + (first));  \</span>
<a name="l01732"></a>01732 <span class="preprocessor">        type * _q_lb = __dcseq_at(type, base, end, (begin) + (last));   \</span>
<a name="l01733"></a>01733 <span class="preprocessor">        type * _q_ib, * _q_jb, * _q_mb;                                 \</span>
<a name="l01734"></a>01734 <span class="preprocessor">        type _q_t = *_q_pb;                                             \</span>
<a name="l01735"></a>01735 <span class="preprocessor">        while (_q_j &lt;= (last)) {                                        \</span>
<a name="l01736"></a>01736 <span class="preprocessor">            _q_jb = __dcseq_at(type, base, end, (begin) + _q_j);        \</span>
<a name="l01737"></a>01737 <span class="preprocessor">            _q_ib = __dcseq_prev(base, end, _q_jb);                     \</span>
<a name="l01738"></a>01738 <span class="preprocessor">            if (greater(_q_jb, _q_ib)) {                                \</span>
<a name="l01739"></a>01739 <span class="preprocessor">                _q_mb = _q_jb;                                          \</span>
<a name="l01740"></a>01740 <span class="preprocessor">                _q_j = (_q_j + 1) &lt;&lt; 1;                                 \</span>
<a name="l01741"></a>01741 <span class="preprocessor">            } else {                                                    \</span>
<a name="l01742"></a>01742 <span class="preprocessor">                _q_mb = _q_ib;                                          \</span>
<a name="l01743"></a>01743 <span class="preprocessor">                _q_j = _q_j &lt;&lt; 1;                                       \</span>
<a name="l01744"></a>01744 <span class="preprocessor">            }                                                           \</span>
<a name="l01745"></a>01745 <span class="preprocessor">            if (greater((&amp;_q_t), _q_mb))                                \</span>
<a name="l01746"></a>01746 <span class="preprocessor">                break;                                                  \</span>
<a name="l01747"></a>01747 <span class="preprocessor">            *_q_pb = *_q_mb;                                            \</span>
<a name="l01748"></a>01748 <span class="preprocessor">            _q_pb = _q_mb;                                              \</span>
<a name="l01749"></a>01749 <span class="preprocessor">        }                                                               \</span>
<a name="l01750"></a>01750 <span class="preprocessor">        if (_q_j == (last) + 1 &amp;&amp; (greater(_q_lb, (&amp;_q_t)))) {          \</span>
<a name="l01751"></a>01751 <span class="preprocessor">            *_q_pb = *_q_lb;                                            \</span>
<a name="l01752"></a>01752 <span class="preprocessor">            *_q_lb = _q_t;                                              \</span>
<a name="l01753"></a>01753 <span class="preprocessor">        } else                                                          \</span>
<a name="l01754"></a>01754 <span class="preprocessor">            *_q_pb = _q_t;                                              \</span>
<a name="l01755"></a>01755 <span class="preprocessor">    } while (0)</span>
<a name="l01756"></a>01756 <span class="preprocessor"></span>
<a name="l01774"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga3b32d00e1ad46490f8dc23d42bb41cca">01774</a> <span class="preprocessor">#define dcseq_make_heap(type, head, begin, _end, greater) do {                      \</span>
<a name="l01775"></a>01775 <span class="preprocessor">        type * _q1_B = (head)-&gt;base;                                                \</span>
<a name="l01776"></a>01776 <span class="preprocessor">        type * _q1_E = (head)-&gt;end;                                                 \</span>
<a name="l01777"></a>01777 <span class="preprocessor">        type * _q1_f = (type *)(begin);                                             \</span>
<a name="l01778"></a>01778 <span class="preprocessor">        size_t _q1_l = __dcseq_distance(_q1_E - _q1_B, (_end) - _q1_f) - 2;         \</span>
<a name="l01779"></a>01779 <span class="preprocessor">        size_t _q1_i = ((_q1_l - 1) &gt;&gt; 1) + 1;                                      \</span>
<a name="l01780"></a>01780 <span class="preprocessor">        while (_q1_i--)                                                             \</span>
<a name="l01781"></a>01781 <span class="preprocessor">            __dcseq_adjust_heap(type, _q1_B, _q1_E, _q1_f, _q1_i, _q1_l, greater);  \</span>
<a name="l01782"></a>01782 <span class="preprocessor">    } while (0)</span>
<a name="l01783"></a>01783 <span class="preprocessor"></span>
<a name="l01799"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga70013a4cedd4531baf023feede4dbb04">01799</a> <span class="preprocessor">#define dcseq_sort_heap(type, head, begin, _end, greater) do {                  \</span>
<a name="l01800"></a>01800 <span class="preprocessor">        type * _q1_B = (head)-&gt;base;                                            \</span>
<a name="l01801"></a>01801 <span class="preprocessor">        type * _q1_E = (head)-&gt;end;                                             \</span>
<a name="l01802"></a>01802 <span class="preprocessor">        type * _q1_e = (type *)(_end);                                          \</span>
<a name="l01803"></a>01803 <span class="preprocessor">        type * _q1_f = (type *)(begin);                                         \</span>
<a name="l01804"></a>01804 <span class="preprocessor">        while (_q1_e != _q1_f) {                                                \</span>
<a name="l01805"></a>01805 <span class="preprocessor">            __dcseq_pop_heap(type, _q1_B, _q1_E, _q1_f, _q1_e, greater);        \</span>
<a name="l01806"></a>01806 <span class="preprocessor">            __dcseq_dec(_q1_B, _q1_E, _q1_e);                                   \</span>
<a name="l01807"></a>01807 <span class="preprocessor">        }                                                                       \</span>
<a name="l01808"></a>01808 <span class="preprocessor">    } while (0)</span>
<a name="l01809"></a>01809 <span class="preprocessor"></span>
<a name="l01819"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga8001a76151ce4cd6ee392b9a579eb8fe">01819</a> <span class="preprocessor">#define dcseq_shuffle(type, head, begin, _end, _RAND) do {                  \</span>
<a name="l01820"></a>01820 <span class="preprocessor">        type * _q_F = (head)-&gt;first;                                        \</span>
<a name="l01821"></a>01821 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                         \</span>
<a name="l01822"></a>01822 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                          \</span>
<a name="l01823"></a>01823 <span class="preprocessor">        type * _q_l = (type *)(_end);                                       \</span>
<a name="l01824"></a>01824 <span class="preprocessor">        type * _q_f = (type *)(begin);                                      \</span>
<a name="l01825"></a>01825 <span class="preprocessor">        size_t _q_j;                                                        \</span>
<a name="l01826"></a>01826 <span class="preprocessor">        __dcseq_dec(_q_B, _q_E, _q_l);                                      \</span>
<a name="l01827"></a>01827 <span class="preprocessor">        _q_j = __dcseq_distance(_q_E - _q_B, _q_l - _q_f) - 1;              \</span>
<a name="l01828"></a>01828 <span class="preprocessor">        while (_q_j) {                                                      \</span>
<a name="l01829"></a>01829 <span class="preprocessor">            size_t _q_n = (_RAND) % (_q_j + 1);                             \</span>
<a name="l01830"></a>01830 <span class="preprocessor">            if (_q_j-- &gt; _q_n) {                                            \</span>
<a name="l01831"></a>01831 <span class="preprocessor">                type * _q_N = __dcseq_at(type, _q_B, _q_E, _q_F + _q_n);    \</span>
<a name="l01832"></a>01832 <span class="preprocessor">                __dcseq_iter_swap(type, _q_l, _q_N);                        \</span>
<a name="l01833"></a>01833 <span class="preprocessor">            }                                                               \</span>
<a name="l01834"></a>01834 <span class="preprocessor">            __dcseq_dec(_q_B, _q_E, _q_l);                                  \</span>
<a name="l01835"></a>01835 <span class="preprocessor">        }                                                                   \</span>
<a name="l01836"></a>01836 <span class="preprocessor">    } while (0)</span>
<a name="l01837"></a>01837 <span class="preprocessor"></span>
<a name="l01846"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga19106e50ba4708aaf2c700eed7ab0eb1">01846</a> <span class="preprocessor">#define dcseq_sort_insert(type, head, begin, _end, newly, greater_equal) \</span>
<a name="l01847"></a>01847 <span class="preprocessor">    do {type _q1_n = (newly);                           \</span>
<a name="l01848"></a>01848 <span class="preprocessor">        type * _q1_f = (begin);                         \</span>
<a name="l01849"></a>01849 <span class="preprocessor">        do {                                            \</span>
<a name="l01850"></a>01850 <span class="preprocessor">            type * _q1_B = (head)-&gt;base;                \</span>
<a name="l01851"></a>01851 <span class="preprocessor">            type * _q1_E = (head)-&gt;end;                 \</span>
<a name="l01852"></a>01852 <span class="preprocessor">            type * _q1_e = (_end);                      \</span>
<a name="l01853"></a>01853 <span class="preprocessor">            while (_q1_f != _q1_e) {                    \</span>
<a name="l01854"></a>01854 <span class="preprocessor">                if (greater_equal(_q1_f, (&amp;_q1_n)))     \</span>
<a name="l01855"></a>01855 <span class="preprocessor">                    break;                              \</span>
<a name="l01856"></a>01856 <span class="preprocessor">                __dcseq_inc(_q1_B, _q1_E, _q1_f);       \</span>
<a name="l01857"></a>01857 <span class="preprocessor">            }                                           \</span>
<a name="l01858"></a>01858 <span class="preprocessor">        } while (0);                                    \</span>
<a name="l01859"></a>01859 <span class="preprocessor">        dcseq_insert(type, head, _q1_f, _q1_n);         \</span>
<a name="l01860"></a>01860 <span class="preprocessor">    } while (0)</span>
<a name="l01861"></a>01861 <span class="preprocessor"></span>
<a name="l01875"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gaef96e240d3b279b8eb2f46bd147c0b92">01875</a> <span class="preprocessor">#define dcseq_is_sorted(type, head, begin, _end, greater_equal, res) \</span>
<a name="l01876"></a>01876 <span class="preprocessor">    do {type * _q_B = (head)-&gt;base;                         \</span>
<a name="l01877"></a>01877 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                          \</span>
<a name="l01878"></a>01878 <span class="preprocessor">        type * _q_e = (_end);                               \</span>
<a name="l01879"></a>01879 <span class="preprocessor">        type * _q_i = (begin);                              \</span>
<a name="l01880"></a>01880 <span class="preprocessor">        type * _q_j = __dcseq_next(_q_B, _q_E, _q_i);       \</span>
<a name="l01881"></a>01881 <span class="preprocessor">        (res) = 1;                                          \</span>
<a name="l01882"></a>01882 <span class="preprocessor">        while (_q_j != _q_e) {                              \</span>
<a name="l01883"></a>01883 <span class="preprocessor">            if (!(greater_equal(_q_j, _q_i))) {             \</span>
<a name="l01884"></a>01884 <span class="preprocessor">                (res) = 0; break;                           \</span>
<a name="l01885"></a>01885 <span class="preprocessor">            }                                               \</span>
<a name="l01886"></a>01886 <span class="preprocessor">            _q_i = _q_j;                                    \</span>
<a name="l01887"></a>01887 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_j);                  \</span>
<a name="l01888"></a>01888 <span class="preprocessor">        }                                                   \</span>
<a name="l01889"></a>01889 <span class="preprocessor">    } while (0)</span>
<a name="l01890"></a>01890 <span class="preprocessor"></span>
<a name="l01901"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gab28cb3d399f9e944a37306161671f051">01901</a> <span class="preprocessor">#define dcseq_bubble_sort(type, head, begin, _end, greater) do {  \</span>
<a name="l01902"></a>01902 <span class="preprocessor">        int _q_pc = 1;                                          \</span>
<a name="l01903"></a>01903 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                             \</span>
<a name="l01904"></a>01904 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                              \</span>
<a name="l01905"></a>01905 <span class="preprocessor">        type * _q_i = (begin);                                  \</span>
<a name="l01906"></a>01906 <span class="preprocessor">        type * _q_f = __dcseq_prev(_q_B, _q_E, _q_i);           \</span>
<a name="l01907"></a>01907 <span class="preprocessor">        type * _q_l = __dcseq_prev(_q_B, _q_E, _end);           \</span>
<a name="l01908"></a>01908 <span class="preprocessor">        while (_q_pc &amp;&amp; _q_i != _q_l) {                         \</span>
<a name="l01909"></a>01909 <span class="preprocessor">            type * _q_j = __dcseq_prev(_q_B, _q_E, _q_l);       \</span>
<a name="l01910"></a>01910 <span class="preprocessor">            _q_pc = 0;                                          \</span>
<a name="l01911"></a>01911 <span class="preprocessor">            while ( _q_j != _q_f) {                             \</span>
<a name="l01912"></a>01912 <span class="preprocessor">                type * _q_k = __dcseq_next(_q_B, _q_E, _q_j);   \</span>
<a name="l01913"></a>01913 <span class="preprocessor">                if (greater(_q_j, _q_k)) {                      \</span>
<a name="l01914"></a>01914 <span class="preprocessor">                    __dcseq_iter_swap(type, _q_j, _q_k);        \</span>
<a name="l01915"></a>01915 <span class="preprocessor">                    _q_pc = 1;                                  \</span>
<a name="l01916"></a>01916 <span class="preprocessor">                }                                               \</span>
<a name="l01917"></a>01917 <span class="preprocessor">                __dcseq_dec(_q_B, _q_E, _q_j);                  \</span>
<a name="l01918"></a>01918 <span class="preprocessor">            }                                                   \</span>
<a name="l01919"></a>01919 <span class="preprocessor">            __dcseq_inc(_q_B, _q_E, _q_i);                      \</span>
<a name="l01920"></a>01920 <span class="preprocessor">        }                                                       \</span>
<a name="l01921"></a>01921 <span class="preprocessor">    } while (0)</span>
<a name="l01922"></a>01922 <span class="preprocessor"></span>
<a name="l01932"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga23f7f28d4e1bb6a16df653258a76ff0f">01932</a> <span class="preprocessor">#define dcseq_oddeven_sort(type, head, begin, _end, greater) do {   \</span>
<a name="l01933"></a>01933 <span class="preprocessor">        int _q_pc = 1;                                              \</span>
<a name="l01934"></a>01934 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                 \</span>
<a name="l01935"></a>01935 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                  \</span>
<a name="l01936"></a>01936 <span class="preprocessor">        type * _q_l = __dcseq_prev(_q_B, _q_E, _end);               \</span>
<a name="l01937"></a>01937 <span class="preprocessor">        type * _q_f = (begin);                                      \</span>
<a name="l01938"></a>01938 <span class="preprocessor">        while (_q_pc) {                                             \</span>
<a name="l01939"></a>01939 <span class="preprocessor">            int _q_w; _q_pc = 0;                                    \</span>
<a name="l01940"></a>01940 <span class="preprocessor">            for (_q_w = 0; _q_w &lt; 2; ++_q_w)                        \</span>
<a name="l01941"></a>01941 <span class="preprocessor">                __dcseq_oddeven_scan(_q_w, type, greater);          \</span>
<a name="l01942"></a>01942 <span class="preprocessor">        }                                                           \</span>
<a name="l01943"></a>01943 <span class="preprocessor">    } while (0)</span>
<a name="l01944"></a>01944 <span class="preprocessor"></span>
<a name="l01945"></a>01945 <span class="preprocessor">#define __dcseq_oddeven_scan(start, type, greater) do {                 \</span>
<a name="l01946"></a>01946 <span class="preprocessor">        type * _q_i = __dcseq_advance(type, _q_B, _q_E, _q_f + start);  \</span>
<a name="l01947"></a>01947 <span class="preprocessor">        type * _q_p = _q_i;                                             \</span>
<a name="l01948"></a>01948 <span class="preprocessor">        while (_q_i != _q_l &amp;&amp; _q_p != _q_l) {                          \</span>
<a name="l01949"></a>01949 <span class="preprocessor">            type * _q_j = __dcseq_next(_q_B, _q_E, _q_i);               \</span>
<a name="l01950"></a>01950 <span class="preprocessor">            if (greater(_q_i, _q_j)) {                                  \</span>
<a name="l01951"></a>01951 <span class="preprocessor">                __dcseq_iter_swap(type, _q_i, _q_j);                    \</span>
<a name="l01952"></a>01952 <span class="preprocessor">                _q_pc = 1;                                              \</span>
<a name="l01953"></a>01953 <span class="preprocessor">            }                                                           \</span>
<a name="l01954"></a>01954 <span class="preprocessor">            _q_p = _q_j;                                                \</span>
<a name="l01955"></a>01955 <span class="preprocessor">            _q_i = __dcseq_advance(type, _q_B, _q_E, _q_i + 2);         \</span>
<a name="l01956"></a>01956 <span class="preprocessor">        }                                                               \</span>
<a name="l01957"></a>01957 <span class="preprocessor">    } while (0)</span>
<a name="l01958"></a>01958 <span class="preprocessor"></span>
<a name="l01969"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga533b795a92e90a8d0c71e25e6ea07ef6">01969</a> <span class="preprocessor">#define dcseq_comb_sort(type, head, begin, _end, greater) do {              \</span>
<a name="l01970"></a>01970 <span class="preprocessor">        int _q_swap = 1;                                                    \</span>
<a name="l01971"></a>01971 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                         \</span>
<a name="l01972"></a>01972 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                          \</span>
<a name="l01973"></a>01973 <span class="preprocessor">        type * _q_e = (_end);                                               \</span>
<a name="l01974"></a>01974 <span class="preprocessor">        type * _q_f = (begin);                                              \</span>
<a name="l01975"></a>01975 <span class="preprocessor">        size_t _q_gap = __dcseq_distance(_q_E - _q_B, _q_e - _q_f) - 1;     \</span>
<a name="l01976"></a>01976 <span class="preprocessor">        while (_q_gap &gt; 1 || _q_swap) {                                     \</span>
<a name="l01977"></a>01977 <span class="preprocessor">            type * _q_i, * _q_j;                                            \</span>
<a name="l01978"></a>01978 <span class="preprocessor">            if (_q_gap &gt; 1)                                                 \</span>
<a name="l01979"></a>01979 <span class="preprocessor">                _q_gap = (size_t)(((double)_q_gap) / 1.247330950103979);    \</span>
<a name="l01980"></a>01980 <span class="preprocessor">            _q_swap = 0;                                                    \</span>
<a name="l01981"></a>01981 <span class="preprocessor">            _q_i = _q_f;                                                    \</span>
<a name="l01982"></a>01982 <span class="preprocessor">            _q_j = __dcseq_advance(type, _q_B, _q_E, _q_f + _q_gap);        \</span>
<a name="l01983"></a>01983 <span class="preprocessor">            while (_q_j != _q_e) {                                          \</span>
<a name="l01984"></a>01984 <span class="preprocessor">                if (greater(_q_i, _q_j)) {                                  \</span>
<a name="l01985"></a>01985 <span class="preprocessor">                    __dcseq_iter_swap(type, _q_i, _q_j);                    \</span>
<a name="l01986"></a>01986 <span class="preprocessor">                    _q_swap = 1;                                            \</span>
<a name="l01987"></a>01987 <span class="preprocessor">                }                                                           \</span>
<a name="l01988"></a>01988 <span class="preprocessor">                __dcseq_inc(_q_B, _q_E, _q_i);                              \</span>
<a name="l01989"></a>01989 <span class="preprocessor">                __dcseq_inc(_q_B, _q_E, _q_j);                              \</span>
<a name="l01990"></a>01990 <span class="preprocessor">            }                                                               \</span>
<a name="l01991"></a>01991 <span class="preprocessor">        }                                                                   \</span>
<a name="l01992"></a>01992 <span class="preprocessor">    } while (0)</span>
<a name="l01993"></a>01993 <span class="preprocessor"></span>
<a name="l02004"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga067b0e3265a2a524f33813d014ede4bb">02004</a> <span class="preprocessor">#define dcseq_select_sort(type, head, begin, _end, greater) do {    \</span>
<a name="l02005"></a>02005 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                 \</span>
<a name="l02006"></a>02006 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                  \</span>
<a name="l02007"></a>02007 <span class="preprocessor">        type * _q_e = (_end);                                       \</span>
<a name="l02008"></a>02008 <span class="preprocessor">        type * _q_i = (begin);                                      \</span>
<a name="l02009"></a>02009 <span class="preprocessor">        type * _q_j = __dcseq_next(_q_B, _q_E, _q_i);               \</span>
<a name="l02010"></a>02010 <span class="preprocessor">        while (_q_j != _q_e) {                                      \</span>
<a name="l02011"></a>02011 <span class="preprocessor">            type * _q_m = _q_i;                                     \</span>
<a name="l02012"></a>02012 <span class="preprocessor">            type * _q_k = _q_j;                                     \</span>
<a name="l02013"></a>02013 <span class="preprocessor">            while (_q_k != _q_e) {                                  \</span>
<a name="l02014"></a>02014 <span class="preprocessor">                if (greater(_q_m, _q_k))                            \</span>
<a name="l02015"></a>02015 <span class="preprocessor">                    _q_m = _q_k;                                    \</span>
<a name="l02016"></a>02016 <span class="preprocessor">                __dcseq_inc(_q_B, _q_E, _q_k);                      \</span>
<a name="l02017"></a>02017 <span class="preprocessor">            }                                                       \</span>
<a name="l02018"></a>02018 <span class="preprocessor">            if (_q_i != _q_m)                                       \</span>
<a name="l02019"></a>02019 <span class="preprocessor">                __dcseq_iter_swap(type, _q_m, _q_i);                \</span>
<a name="l02020"></a>02020 <span class="preprocessor">            _q_i = _q_j;                                            \</span>
<a name="l02021"></a>02021 <span class="preprocessor">            _q_j = __dcseq_next(_q_B, _q_E, _q_j);                  \</span>
<a name="l02022"></a>02022 <span class="preprocessor">        }                                                           \</span>
<a name="l02023"></a>02023 <span class="preprocessor">    } while (0)</span>
<a name="l02024"></a>02024 <span class="preprocessor"></span>
<a name="l02035"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga0383a8dd2d6850231e26d4c5bbc894b5">02035</a> <span class="preprocessor">#define dcseq_insert_sort(type, head, begin, _end, greater) do {        \</span>
<a name="l02036"></a>02036 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                     \</span>
<a name="l02037"></a>02037 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                      \</span>
<a name="l02038"></a>02038 <span class="preprocessor">        type * _q_l = __dcseq_prev(_q_B, _q_E, _end);                   \</span>
<a name="l02039"></a>02039 <span class="preprocessor">        type * _q_f = (begin);                                          \</span>
<a name="l02040"></a>02040 <span class="preprocessor">        type * _q_i = _q_l;                                             \</span>
<a name="l02041"></a>02041 <span class="preprocessor">        while (_q_i != _q_f) {                                          \</span>
<a name="l02042"></a>02042 <span class="preprocessor">            type * _q_j = _q_l;                                         \</span>
<a name="l02043"></a>02043 <span class="preprocessor">            __dcseq_dec(_q_B, _q_E, _q_i);                              \</span>
<a name="l02044"></a>02044 <span class="preprocessor">            while (_q_j != _q_i) {                                      \</span>
<a name="l02045"></a>02045 <span class="preprocessor">                if (greater(_q_i, _q_j)) {                              \</span>
<a name="l02046"></a>02046 <span class="preprocessor">                    type _q_t = *_q_i;                                  \</span>
<a name="l02047"></a>02047 <span class="preprocessor">                    if (_q_i &gt; _q_j) {                                  \</span>
<a name="l02048"></a>02048 <span class="preprocessor">                        memcpy(_q_i, _q_i + 1, sizeof(type) *           \</span>
<a name="l02049"></a>02049 <span class="preprocessor">                               (_q_E - _q_i - 1));                      \</span>
<a name="l02050"></a>02050 <span class="preprocessor">                        *(_q_E - 1) = *_q_B;                            \</span>
<a name="l02051"></a>02051 <span class="preprocessor">                        memcpy(_q_B, _q_B + 1, sizeof(type) *           \</span>
<a name="l02052"></a>02052 <span class="preprocessor">                               (_q_j - _q_B));                          \</span>
<a name="l02053"></a>02053 <span class="preprocessor">                    } else                                              \</span>
<a name="l02054"></a>02054 <span class="preprocessor">                        memcpy(_q_i, _q_i + 1, sizeof(type) *           \</span>
<a name="l02055"></a>02055 <span class="preprocessor">                               (__dcseq_distance(_q_E - _q_B,           \</span>
<a name="l02056"></a>02056 <span class="preprocessor">                                                _q_j - _q_i) - 1));     \</span>
<a name="l02057"></a>02057 <span class="preprocessor">                    *_q_j = _q_t;                                       \</span>
<a name="l02058"></a>02058 <span class="preprocessor">                    break;                                              \</span>
<a name="l02059"></a>02059 <span class="preprocessor">                }                                                       \</span>
<a name="l02060"></a>02060 <span class="preprocessor">                __dcseq_dec(_q_B, _q_E, _q_j);                          \</span>
<a name="l02061"></a>02061 <span class="preprocessor">            }                                                           \</span>
<a name="l02062"></a>02062 <span class="preprocessor">        }                                                               \</span>
<a name="l02063"></a>02063 <span class="preprocessor">    } while (0)</span>
<a name="l02064"></a>02064 <span class="preprocessor"></span>
<a name="l02075"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gac737294728c7c43c4d003b1f82690a41">02075</a> <span class="preprocessor">#define dcseq_shell_sort(type, head, begin, _end, greater) do {                 \</span>
<a name="l02076"></a>02076 <span class="preprocessor">        type * _q_B = (head)-&gt;base;                                             \</span>
<a name="l02077"></a>02077 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                                              \</span>
<a name="l02078"></a>02078 <span class="preprocessor">        type * _q_e = (_end);                                                   \</span>
<a name="l02079"></a>02079 <span class="preprocessor">        type * _q_f = (begin);                                                  \</span>
<a name="l02080"></a>02080 <span class="preprocessor">        size_t _q_gap = (__dcseq_distance(_q_E - _q_B, _q_e - _q_f) - 1) &gt;&gt; 1;  \</span>
<a name="l02081"></a>02081 <span class="preprocessor">        for (; _q_gap; _q_gap &gt;&gt;= 1) {                                          \</span>
<a name="l02082"></a>02082 <span class="preprocessor">            type * _q_i = __dcseq_advance(type, _q_B, _q_E, _q_f + _q_gap);     \</span>
<a name="l02083"></a>02083 <span class="preprocessor">            while (_q_i != _q_e) {                                              \</span>
<a name="l02084"></a>02084 <span class="preprocessor">                type _q_t = *_q_i;                                              \</span>
<a name="l02085"></a>02085 <span class="preprocessor">                type * _q_k = _q_i;                                             \</span>
<a name="l02086"></a>02086 <span class="preprocessor">                type * _q_j = __dcseq_advance(type, _q_B, _q_E, _q_i - _q_gap); \</span>
<a name="l02087"></a>02087 <span class="preprocessor">                while (__dcseq_exist(_q_B, _q_f, _q_e, _q_E, _q_j)              \</span>
<a name="l02088"></a>02088 <span class="preprocessor">                        &amp;&amp; (greater(_q_j, (&amp;_q_t)))) {                          \</span>
<a name="l02089"></a>02089 <span class="preprocessor">                    *_q_k = *_q_j;                                              \</span>
<a name="l02090"></a>02090 <span class="preprocessor">                    _q_k = _q_j;                                                \</span>
<a name="l02091"></a>02091 <span class="preprocessor">                    __dcseq_sub(type, _q_B, _q_E, _q_j, _q_gap);                \</span>
<a name="l02092"></a>02092 <span class="preprocessor">                }                                                               \</span>
<a name="l02093"></a>02093 <span class="preprocessor">                *_q_k = _q_t;                                                   \</span>
<a name="l02094"></a>02094 <span class="preprocessor">                __dcseq_inc(_q_B, _q_E, _q_i);                                  \</span>
<a name="l02095"></a>02095 <span class="preprocessor">            }                                                                   \</span>
<a name="l02096"></a>02096 <span class="preprocessor">        }                                                                       \</span>
<a name="l02097"></a>02097 <span class="preprocessor">    } while (0)</span>
<a name="l02098"></a>02098 <span class="preprocessor"></span>
<a name="l02099"></a>02099 <span class="comment">/* 计数排序和鸽巢排序(仅限于有限整数序列，需事先将hole清零) */</span>
<a name="l02100"></a>02100 <span class="preprocessor">#ifndef COUNTING_SIZE</span>
<a name="l02101"></a>02101 <span class="preprocessor"></span>
<a name="l02110"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga0e81257e6808089aea04c746c3b14b0b">02110</a> <span class="preprocessor">#define COUNTING_SIZE(_min, _max) ((_max) - (_min) + 1)</span>
<a name="l02111"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#gabe56db9f8a1c3e4e29a31b7597b9b59e">02111</a> <span class="preprocessor"></span><span class="preprocessor">#define PIGEONHOLE_SIZE(_max) ((_max) + 1)</span>
<a name="l02112"></a>02112 <span class="preprocessor"></span><span class="preprocessor">#endif  </span><span class="comment">/* #ifndef COUNTING_SIZE */</span>
<a name="l02113"></a>02113 
<a name="l02136"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga233c96443471123318f2de6262eefa20">02136</a> <span class="preprocessor">#define dcseq_counting_sort(type, head, begin, _end, hole, _min, _max) \</span>
<a name="l02137"></a>02137 <span class="preprocessor">    do {type * _q_B = (head)-&gt;base;                         \</span>
<a name="l02138"></a>02138 <span class="preprocessor">        type * _q_E = (head)-&gt;end;                          \</span>
<a name="l02139"></a>02139 <span class="preprocessor">        type * _q_hole = (type *)(hole);                    \</span>
<a name="l02140"></a>02140 <span class="preprocessor">        type * _q_e = (_end);                               \</span>
<a name="l02141"></a>02141 <span class="preprocessor">        type * _q_f = (begin);                              \</span>
<a name="l02142"></a>02142 <span class="preprocessor">        type _q_min = (_min);                               \</span>
<a name="l02143"></a>02143 <span class="preprocessor">        type _q_cnt = (_max) - _q_min + 1;                  \</span>
<a name="l02144"></a>02144 <span class="preprocessor">        type _q_i = 0;                                      \</span>
<a name="l02145"></a>02145 <span class="preprocessor">        memset(_q_hole, 0, sizeof(type) * _q_cnt);          \</span>
<a name="l02146"></a>02146 <span class="preprocessor">        while (_q_e != _q_f) {                              \</span>
<a name="l02147"></a>02147 <span class="preprocessor">            __dcseq_dec(_q_B, _q_E, _q_e);                  \</span>
<a name="l02148"></a>02148 <span class="preprocessor">            ++_q_hole[*_q_e - _q_min];                      \</span>
<a name="l02149"></a>02149 <span class="preprocessor">        }                                                   \</span>
<a name="l02150"></a>02150 <span class="preprocessor">        for (; _q_i &lt; _q_cnt; ++_q_i) {                     \</span>
<a name="l02151"></a>02151 <span class="preprocessor">            size_t _q_c = _q_hole[_q_i];                    \</span>
<a name="l02152"></a>02152 <span class="preprocessor">            while (_q_c--) {                                \</span>
<a name="l02153"></a>02153 <span class="preprocessor">                *_q_f = _q_i;                               \</span>
<a name="l02154"></a>02154 <span class="preprocessor">                __dcseq_inc(_q_B, _q_E, _q_f);              \</span>
<a name="l02155"></a>02155 <span class="preprocessor">            }                                               \</span>
<a name="l02156"></a>02156 <span class="preprocessor">        }                                                   \</span>
<a name="l02157"></a>02157 <span class="preprocessor">    } while (0)</span>
<a name="l02158"></a>02158 <span class="preprocessor"></span>
<a name="l02180"></a><a class="code" href="group___xE5_x8F_x8C_xE7_xAB_xAF_xE7_x8E_xAF_xE5_xBD_xA2_xE5_xBA_x8F_xE8_xA1_xA8.html#ga0d1f01908ac57276f253d972c0152120">02180</a> <span class="preprocessor">#define dcseq_pigeonhole_sort(type, head, begin, _end, hole, _max) \</span>
<a name="l02181"></a>02181 <span class="preprocessor">    dcseq_counting_sort(type, head, begin, _end, hole, 0, _max)</span>
<a name="l02182"></a>02182 <span class="preprocessor"></span>
<a name="l02185"></a>02185 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l02186"></a>02186 <span class="preprocessor"></span>}
<a name="l02187"></a>02187 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l02188"></a>02188 
<a name="l02189"></a>02189 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_DCSEQ__ */</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
